Java Unicode Create toUnicode(StringBuilder strBuilder, char ch)

Here you can find the source of toUnicode(StringBuilder strBuilder, char ch)

Description

to Unicode

License

LGPL

Declaration

private static void toUnicode(StringBuilder strBuilder, char ch) 

Method Source Code

//package com.java2s;
/*//from ww  w.ja  va2 s.c  om
 * MoXie (SysTem128@GMail.Com) 2009-3-11 10:06:36
 * 
 * Copyright © 2008-2009 Zoeey.Org
 * Code license: GNU Lesser General Public License Version 3
 * http://www.gnu.org/licenses/lgpl-3.0.txt
 */

public class Main {
    private static final char[] hexs = "0123456789abcdef".toCharArray();

    private static void toUnicode(StringBuilder strBuilder, char ch) {
        /**
         * standard unicode format
         */
        strBuilder.append("\\u");
        for (int i = 4; i > 0; i--) {
            strBuilder.append(hexs[(ch & 0xf000) >> 12]);
            ch <<= 4;
        }
    }
}

Related

  1. toUnicode(String strText)
  2. toUnicode(String text)
  3. toUnicode(String text)
  4. toUnicode(String theString, boolean escapeSpace)
  5. toUnicode(String value)
  6. toUnicodeBytes(String str)
  7. toUnicodeEncoded(String data)
  8. toUnicodeEscape(char c)
  9. toUnicodeEscape(int ch)