I have 16k chars in String variable, and got an er...
# announcements
m
I have 16k chars in String variable, and got an error when try to manipulate this string
d
What's the error?
m
Cause: UTF8 string too large
d
can you link your testcase?
m
cant paste here)
d
you can share a play.kotlinlang link
there is a share button on the right
m
my string is 1288000 bytes
its not bigger than MAX_INT
d
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
I am not using it in source code, This string is a result and i need to process it
d
well, then you need to post the actual error message. the example you posted crashes the compiler
m
i want to cut it in size according to some conditions
d
and i mean the full stack trace
m
If i just print this string in my code, all is ok)
But I need to process this string somehow
d
again, please post the actual error message you are getting.
complete stack trace
m
The problem is only when I specify this string as a constant
I cant get the error, coze Intelijidea hangs)
d
you said you didn't have it as a constant...
m
yes
But temporary, for dev porposes, in order to skip the code before, I specified it as a constant
d
don't...
m
I just try to leave the code as usual
d
if you need it, put it in a text file and use File(...).readText()