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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -