weird number conversion in Java -
i testing , calling stringtokenizer , getting weird conversion... forget fact should delimiting \ in "\7767546" i'm curious what's \11 until \77 in java
here code:
string path = "c:\\temp\\\\7800000\7767546.pdf"; string delimeter = "\\"; string[] values = new string[3]; int counter = 0; stringtokenizer st = new stringtokenizer(path,delimeter); while(st.hasmoretokens()){ values[counter] = st.nexttoken(); system.out.println(" values[counter]" + values[counter]); ++counter; } here's output:
values[counter]c: values[counter]temp values[counter]7800000?67546.pdf if notice, \77 in original string became ? .....is unicode thing?
as java language specification states
octalescape: \ octaldigit \ octaldigit octaldigit \ zerotothree octaldigit octaldigit octaldigit: 1 of 0 1 2 3 4 5 6 7 zerotothree: 1 of 0 1 2 3 the following string or character literal octal escape
\77 in octal, value 77 63 ? character.
note has nothing stringtokenizer. applies string literal
"c:\\temp\\\\7800000\7767546.pdf" which, if printed out, print as
c:\temp\\7800000?67546.pdf because value stored.
Comments
Post a Comment