https://kotlinlang.org logo
Title
v

Vitali Plagov

06/20/2022, 7:22 PM
Hi. I'm probably missing some basic essential stuff, if so could someone please point me into a correct direction? I have a string
"aaa\"aaa"
. When I evaluate an expression while in debug and check the length of the string, then it shows it is 8. But checking the same in the scratch file - it shows length equal to 7. Why is it so? What am I missing?
c

Chris Lee

06/20/2022, 7:45 PM
One of them contains an embedded
"
character that is being displayed as
\"
, whereas the other (longer) one contains
\"
.
k

Klitos Kyriacou

06/20/2022, 9:28 PM
Exactly what Chris said. It's an unfortunate coincidence of the fact the debugger displays string values by simply putting their
toString
representation inside quotes, which gives them the misleading resemblance to string literals.