Special Java characters in String -
i confused, have strings in java that:
string str = "str \u0923 else"; how handle characters casual characters (not java special characters), mean str[4] '\' not ण (in unicode \u0923 = ण) unicode character. asking mechanical solution not manual.
the jls says unicode backslash escapes interpretted if file written actual character encoded there instead. it's source level replacements, , has nothing string literals.
for example, here compilable java unicode escapes used instead of quotes , semicolons:
class test { string = \u0022hello world"\u003b } this means given string reference, there no way determine if original source file contained ण or \u0923 in assignment.
it's similar how there no way differentiate of s1 , s2 assigned + in it:
string s1 = "hello " + "world"; string s2 = "hello world";
Comments
Post a Comment