Android Utililty Methods String Remove

List of utility methods to do String Remove

Description

The list of methods to do String Remove are organized into topic(s).

Method

StringremoveAccents(String string)
remove Accents
return string == null ? null : Normalizer.normalize(string,
        Normalizer.Form.NFD).replaceAll(
        "\\p{InCombiningDiacriticalMarks}+", "");
StringremoveBackslashes(String content)
Removes unwanted backslashes characters
if (content == null) {
    return null;
StringBuffer buff = new StringBuffer();
buff.append(content);
int len = buff.length();
for (int i = len - 1; i >= 0; i--) {
    if ('\\' == buff.charAt(i))
...
ListremoveDuplicates(String[] first, String[] second)
remove Duplicates
List<String> result = new ArrayList<String>(Arrays.asList(first));
for (int i = 0; i < second.length; i++) {
    if (!result.contains(second[i])) {
        result.add(second[i]);
return result;
StringremoveSpace(String str)
remove Space
if (!TextUtils.isEmpty(str)) {
    return str.trim().replaceAll(" ", "");
} else {
    return str;
StringremoveSuffix(String str, String suffix)
remove Suffix
if (null == str)
    return null;
if ("".equals(str.trim()))
    return "";
if (null == suffix || "".equals(suffix))
    return str;
if (str.endsWith(suffix)) {
    return str.substring(0, str.length() - suffix.length());
...
StringremoveWhitespace(String str)
remove Whitespace
if (isEmpty(str)) {
    return str;
int sz = str.length();
char[] chs = new char[sz];
int count = 0;
for (int i = 0; i < sz; i++) {
    if (!Character.isWhitespace(str.charAt(i))) {
...
StringrmvSpace(String baseStr)
rmv Space
return baseStr.replace(" ", "");
StringrmvSpecial(String baseStr)
rmv Special
String rmvStr = baseStr;
for (int i = 0; i < SPECIAL_CHARACTER_CODES.length; i++) {
    rmvStr = rmvStr.replaceAll(SPECIAL_CHARACTER_CODES[i],
            SPECIAL_CHARACTER_SYMBOLS[i]);
return rmvStr;
StringremoveBlanks(String content)
Removes unwanted blank characters
if (content == null) {
    return null;
StringBuffer buff = new StringBuffer();
buff.append(content);
for (int i = buff.length() - 1; i >= 0; i--) {
    if (' ' == buff.charAt(i)) {
        buff.deleteCharAt(i);
...
StringrmvBlankLines(String input)
rmv Blank Lines
return input.replaceAll("((\r\n)|\n)[\\s\t ]*(\\1)+", "$1");