Java Unicode Escape unicodeEscaped(Character ch)

Here you can find the source of unicodeEscaped(Character ch)

Description

unicode Escaped

License

Open Source License

Declaration

public static String unicodeEscaped(Character ch) 

Method Source Code

//package com.java2s;

public class Main {
    public static String unicodeEscaped(char ch) {
        if (ch < 0x10) {
            return "\\u000" + Integer.toHexString(ch);
        } else if (ch < 0x100) {
            return "\\u00" + Integer.toHexString(ch);
        } else if (ch < 0x1000) {
            return "\\u0" + Integer.toHexString(ch);
        }//from w  w w  .  j a  v a  2s .  c  o  m
        return "\\u" + Integer.toHexString(ch);
    }

    public static String unicodeEscaped(Character ch) {
        if (ch == null) {
            return null;
        }
        return unicodeEscaped(ch.charValue());
    }
}

Related

  1. unicodeEscape(String s)
  2. unicodeEscape(String s)
  3. unicodeEscape(StringBuilder result, int in, int index)
  4. unicodeEscaped(char ch)
  5. unicodeEscaped(Character ch)
  6. unicodeEscaped(final Character ch)
  7. unicodeEscaped(final String str)
  8. unicodeEscapeEncode(String unicode)
  9. unicodeHexEscapeJava(char ch)