I need to do this:
while (result2.charAt(j)!='\'){ }
I get an error: Invalid character constant.
Invalid character constant
Why? and how can i overcome it?
A backslash is a special character and must be reset using another backslash. Like this:
while (result2.charAt(j)!='\\'){ }
Use '\\'. This is because the backslash is used in the escape sequence, for example '\n'. With one, the \compiler has no way to find out.
'\\'
'\n'
\
, .
, ,
,
while(results2.charAt(j)!='\\') { }
, , ,
'\'
" " " == " \" " " \ " == " \\ "
Eclipse Android, , , Java ( ) . - "sampleword" , , , , , .
"sampleword"
, Unicode.
005C - . : "\ u005C".
:
str = str.replace("\\u005C", "'\\u005C'");