Java Unicode to hex string -
this question has answer here:
- get unicode value of character 7 answers
the code below gives me unicode string கா
sysout = new printstream(system.out, true, "utf-8"); sysout.println("\u0b95\u0bbe");
by giving கா input, can hex values \u0b95 , \u0bbe?
ps: tamil language.
according this you'll have try
system.out.println( "\\u" + integer.tohexstring('க' | 0x10000).substring(1) );
but work on unicode 3.0. if want more values, create loop, e.g.
string foo = "கா"; (int = 0; < foo.length(); i++) system.out.println( "\\u" + integer.tohexstring(foo.charat(i) | 0x10000).substring(1));
which produces
\u0b95 \u0bbe
if want have them in 1 line, change system.out.println()
system.out.print()
, add system.out.print("\n")
in end.
Comments
Post a Comment