Android examples for java.lang:Character
remove Blank character from string
import android.text.TextUtils; import java.util.Locale; import java.util.UUID; public class Main{ public static String removeBlanks(String content) { if (content == null) { return null; }//from www . j av a 2 s .co m StringBuilder buff = new StringBuilder(); buff.append(content); for (int i = buff.length() - 1; i >= 0; i--) { if (' ' == buff.charAt(i) || ('\n' == buff.charAt(i)) || ('\t' == buff.charAt(i)) || ('\r' == buff.charAt(i))) { buff.deleteCharAt(i); } } return buff.toString(); } }