Android String Remove remove(String str, char remove)

Here you can find the source of remove(String str, char remove)

Description

remove

Declaration

public static String remove(String str, char remove) 

Method Source Code

//package com.java2s;

public class Main {

    public static String remove(String str, char remove) {
        if (isEmpty(str) || str.indexOf(remove) == -1) {
            return str;
        }/*from   w w  w . j a v  a  2s.  c o  m*/
        char[] chars = str.toCharArray();
        int pos = 0;
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] != remove) {
                chars[pos++] = chars[i];
            }
        }
        return new String(chars, 0, pos);
    }

    public static boolean isEmpty(String str) {
        return str == null || str.length() == 0;
    }

    public static int indexOf(String str, String searchStr) {
        if (str == null || searchStr == null) {
            return -1;
        }
        return str.indexOf(searchStr);
    }
}

Related

  1. removeWhitespace(String str)
  2. rmvSpace(String baseStr)
  3. rmvSpecial(String baseStr)
  4. removeBlanks(String content)
  5. rmvBlankLines(String input)
  6. removeCharacters(String x, char... cs)
  7. removeCommaChar(String str)
  8. removeMinusChar(String str)
  9. removePhotoFromVCard(String vcard)