Java Unicode Create toUnicode(char c)

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

Description

to Unicode

License

Apache License

Declaration

public static String toUnicode(char c) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String toUnicode(char c) {
        return toUnicode(String.valueOf(c));
    }/*w ww.j a v  a  2 s .co m*/

    public static String toUnicode(String original) {
        if (original == null) {
            return "";
        }

        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < original.length(); i++) {
            sb.append(String.format("\\u%04X", Character.codePointAt(original, i)));
        }
        String unicode = sb.toString();
        return unicode;
    }

    public static String format(final String pattern, final Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(pattern);
        return formatter.format(date);
    }
}

Related

  1. getUnicodeByteArray(String str)
  2. getUnicodeBytes(String s)
  3. getUnicodeString(byte bytes[], int offset, int len)
  4. getUnicodeString(byte[] d, int length, int pos)
  5. getUnicodeText(Object text)
  6. toUnicode(final String toUnicode, final boolean toLowerCase)
  7. toUnicode(String input)
  8. toUnicode(String input)
  9. toUnicode(String input)