Java tutorial
//package com.java2s; public class Main { public static String toSBC(String s) { if (isEmpty(s)) return s; char[] chars = s.toCharArray(); for (int i = 0, len = chars.length; i < len; i++) { if (chars[i] == ' ') { chars[i] = (char) 12288; } else if (33 <= chars[i] && chars[i] <= 126) { chars[i] = (char) (chars[i] + 65248); } else { chars[i] = chars[i]; } } return new String(chars); } public static boolean isEmpty(CharSequence s) { return s == null || s.length() == 0; } public static int length(CharSequence s) { return s == null ? 0 : s.length(); } }