Here you can find the source of fullWidthToHalfWidth(String s)
public static String fullWidthToHalfWidth(String s)
//package com.java2s; public class Main { public static String fullWidthToHalfWidth(String s) { if (isEmpty(s)) { return s; }/*from ww w . j a va2 s .c o m*/ char[] source = s.toCharArray(); for (int i = 0; i < source.length; i++) { if (source[i] == 12288) { source[i] = ' '; // } else if (source[i] == 12290) { // source[i] = '.'; } else if (source[i] >= 65281 && source[i] <= 65374) { 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("") = true; * isEmpty(" ") = 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); } }