Android Unicode Convert halfWidthToFullWidth(String s)

Here you can find the source of halfWidthToFullWidth(String s)

Description

half Width To Full Width

Declaration

public static String halfWidthToFullWidth(String s) 

Method Source Code

//package com.java2s;

public class Main {

    public static String halfWidthToFullWidth(String s) {
        if (isEmpty(s)) {
            return s;
        }// w  ww  . j a v a2  s.  c om

        char[] source = s.toCharArray();
        for (int i = 0; i < source.length; i++) {
            if (source[i] == ' ') {
                source[i] = (char) 12288;
                // } else if (source[i] == '.') {
                // source[i] = (char)12290;
            } else if (source[i] >= 33 && source[i] <= 126) {
                source[i] = (char) (source[i] + 65248);
            } else {
                source[i] = source[i];
            }
        }
        return new String(source);
    }

    /**
     * is null or its length is 0
     * 
     * <pre>
     * isEmpty(null) = true;
     * isEmpty(&quot;&quot;) = true;
     * isEmpty(&quot;  &quot;) = false;
     * </pre>
     * 
     * @param str
     * @return if string is null or its size is 0, return true, else return false.
     */
    public static boolean isEmpty(String str) {
        return (str == null || str.length() == 0);
    }
}

Related

  1. ToDBC(String input)
  2. unicodePreservingIndex(String paramString, int paramInt)
  3. unicodePreservingIndex(String str, int index)
  4. fullWidthToHalfWidth(String s)
  5. getEncodedSize(String value)
  6. bytes2StringUNICODE(byte[] buf, int offset, int length, boolean bigEndian)
  7. asciiToBCD(byte[] ascii_buf, int asc_offset, byte[] bcd_buf, int bcd_offset, int conv_len, int type)
  8. convertToUnicodeByteArray(String s)
  9. convertToUnicode(byte[] b, boolean includesNull)