https://kotlinlang.org logo
#announcements
Title
# announcements
m

mike_shysh

07/05/2019, 11:11 AM
I have 16k chars in String variable, and got an error when try to manipulate this string
d

diesieben07

07/05/2019, 11:12 AM
What's the error?
m

mike_shysh

07/05/2019, 11:13 AM
Cause: UTF8 string too large
d

diesieben07

07/05/2019, 11:13 AM
can you link your testcase?
m

mike_shysh

07/05/2019, 11:18 AM
cant paste here)
d

diesieben07

07/05/2019, 11:19 AM
you can share a play.kotlinlang link
there is a share button on the right
m

mike_shysh

07/05/2019, 11:19 AM
my string is 1288000 bytes
its not bigger than MAX_INT
d

diesieben07

07/05/2019, 11:21 AM
seems there is a limit due to the architecture of the kotlin compiler
i would argue that having such a large string literal in your source code is anti pattern
m

mike_shysh

07/05/2019, 11:24 AM
I am not using it in source code, This string is a result and i need to process it
d

diesieben07

07/05/2019, 11:25 AM
well, then you need to post the actual error message. the example you posted crashes the compiler
m

mike_shysh

07/05/2019, 11:25 AM
i want to cut it in size according to some conditions
d

diesieben07

07/05/2019, 11:25 AM
and i mean the full stack trace
m

mike_shysh

07/05/2019, 11:25 AM
If i just print this string in my code, all is ok)
But I need to process this string somehow
d

diesieben07

07/05/2019, 11:26 AM
again, please post the actual error message you are getting.
complete stack trace
m

mike_shysh

07/05/2019, 11:29 AM
The problem is only when I specify this string as a constant
I cant get the error, coze Intelijidea hangs)
d

diesieben07

07/05/2019, 11:29 AM
you said you didn't have it as a constant...
m

mike_shysh

07/05/2019, 11:30 AM
yes
But temporary, for dev porposes, in order to skip the code before, I specified it as a constant
d

diesieben07

07/05/2019, 11:31 AM
don't...
m

mike_shysh

07/05/2019, 11:31 AM
I just try to leave the code as usual
d

diesieben07

07/05/2019, 11:31 AM
if you need it, put it in a text file and use File(...).readText()
14 Views