Java Unicode Create toUnicode(String str)

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

Description

to Unicode

License

Open Source License

Declaration

public static String toUnicode(String str) 

Method Source Code

//package com.java2s;

public class Main {

    public static String toUnicode(String str) {
        String as[] = new String[str.length()];
        String s1 = "";
        for (int i = 0; i < str.length(); i++) {
            int v = str.charAt(i);
            if (v >= 19968 && v <= 171941) {
                as[i] = Integer.toHexString(str.charAt(i) & 0xffff);
                s1 = s1 + "\\u" + as[i];
            } else {
                s1 = s1 + str.charAt(i);
            }/*  w  w  w .j a  v a2  s.  c o  m*/
        }
        return s1;
    }
}

Related

  1. toUnicode(String input)
  2. toUnicode(String original)
  3. toUnicode(String s)
  4. toUnicode(String source)
  5. toUnicode(String str)
  6. toUnicode(String str)
  7. toUnicode(String str)
  8. toUnicode(String string)
  9. toUnicode(String strText)