Java Unicode Create toUnicodeValue(char c)

Here you can find the source of toUnicodeValue(char c)

Description

to Unicode Value

License

Mozilla Public License

Declaration

public static String toUnicodeValue(char c) 

Method Source Code

//package com.java2s;
/** This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *//* w w w.j a v  a  2  s.  c o m*/

public class Main {
    public static String toUnicodeValue(char c) {
        String s = Integer.toHexString(c);
        int length = s.length();
        for (int i = 1; i < 5 - length; i++) {
            s = "0" + s;
        }
        return "\\u" + s.toUpperCase();
    }
}

Related

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