Android Unicode Convert stringToUnicode(String strText)

Here you can find the source of stringToUnicode(String strText)

Description

string To Unicode

Declaration

public static String stringToUnicode(String strText) 

Method Source Code

//package com.java2s;

public class Main {

    public static String stringToUnicode(String strText) {
        char c;//  w  w w .  ja  v a  2  s  . co  m
        String strRet = "";
        int intAsc;
        String strHex;
        for (int i = 0; i < strText.length(); i++) {
            c = strText.charAt(i);
            intAsc = (int) c;
            strHex = Integer.toHexString(intAsc);
            if (intAsc > 128) {
                strRet += "\\u" + strHex;
            } else {
                strRet += "\\u00" + strHex;
            }
        }
        return strRet;
    }
}

Related

  1. halfWidthToFullWidth(String s)
  2. bytes2StringUNICODE(byte[] buf, int offset, int length, boolean bigEndian)
  3. asciiToBCD(byte[] ascii_buf, int asc_offset, byte[] bcd_buf, int bcd_offset, int conv_len, int type)
  4. convertToUnicodeByteArray(String s)
  5. convertToUnicode(byte[] b, boolean includesNull)
  6. unicode2han3last_direct(Character c)
  7. unicode2han_str(String str)
  8. unicodeEscape(String s)
  9. getEmojiByUnicode(int unicode)