Java Unicode Create toUnicodeString(String str)

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

Description

to Unicode String

License

Open Source License

Declaration

public static String toUnicodeString(String str) 

Method Source Code

//package com.java2s;

public class Main {

    public static String toUnicodeString(String str) {
        String unicode = "";
        char[] charAry = new char[str.length()];
        for (int i = 0; i < charAry.length; ++i) {
            charAry[i] = str.charAt(i);//  www.  ja  v  a2  s.  c o m
            unicode = unicode + "\\u" + Integer.toString(charAry[i], 16);
        }
        return unicode;
    }
}

Related

  1. toUnicodeString(byte[] data)
  2. toUnicodeString(char c)
  3. toUnicodeString(char[] chars)
  4. toUnicodeString(String baseString)
  5. toUnicodeString(String s)
  6. toUnicodeSymbols(String s)
  7. toUnicodeValue(char c)
  8. toUnicodeValue(char c)