Full-width to half-width rules: 1. The full-width space is 12288, and the half-width space is 32 special processing; 2. Other characters (33-126) and the full-width (65281-65374) is 65248 different. Java full-width conversion code:
/*** StringUtils *** @ author tongqian. zhang */public class StringUtils {/*** determines whether the String is null or an empty String * @ param str the original String * @ return */public static boolean isEmpty (String str) {return str = null | "". equals (str);}/*** fullwidth to halfwidth: * @ param fullStr * @ return */public static final String full2Half (String fullStr) {if (isEmpty (fullStr )) {return fullStr;} char [] c = fullStr. toCharArray (); for (int I = 0; I <c. length; I ++) {if (c [I]> = 65281 & c [I] <= 65374) {c [I] = (char) (c [I]-65248);} else if (c [I] = 12288) {// Space c [I] = (char) 32 ;}} return new String (c);}/*** halfwidth to fullwidth * @ param halfStr * @ return */public static final String half2Full (String halfStr) {if (isEmpty (halfStr) {return halfStr;} char [] c = halfStr. toCharArray (); for (int I = 0; I <c. length; I ++) {if (c [I] = 32) {c [I] = (char) 12288;} else if (c [I] <127) {c [I] = (char) (c [I] + 65248) ;}return new String (c );}}