java - Convert String to its Unicode code point -


assuming have string foo = "this apple"

the unicode code point equivalent be

" \\x74\\x68\\x69\\x73.......... \\x61\\x70\\x70\\x6c\\x65 "

   t    h      s  .............    p    p    l   e 

how convert string foo

to

string " \\x74\\x68\\x69\\x73.......... \\x61\\x70\\x70\\x6c\\x65 "

try this..

        public static string generateunicode(string input) {             stringbuilder b = new stringbuilder(input.length());             (char c : input.tochararray()) {                  b.append(string.format("\\u%04x", (int) c));              }             return b.tostring();         } 

Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -