Java Unicode Create toUnicode(String s)

Here you can find the source of toUnicode(String s)

Description

to Unicode

License

Open Source License

Declaration

public static String toUnicode(String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String toUnicode(String s) {
        //if (s.length() != 1) throw new RuntimeException("toUnicode input must be a single character");
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); ++i)
            sb.append(toUnicode(s.charAt(i)));
        return sb.toString();
    }/*from   w w w.  j  a  v  a  2s.  co  m*/

    public static String toUnicode(char c) {
        return "\\u" + Integer.toHexString(c | 0x10000).substring(1);
    }
}

Related

  1. toUnicode(final String toUnicode, final boolean toLowerCase)
  2. toUnicode(String input)
  3. toUnicode(String input)
  4. toUnicode(String input)
  5. toUnicode(String original)
  6. toUnicode(String source)
  7. toUnicode(String str)
  8. toUnicode(String str)
  9. toUnicode(String str)