Android String Remove removeMinusChar(String str)

Here you can find the source of removeMinusChar(String str)

Description

remove Minus Char

Declaration

public static String removeMinusChar(String str) 

Method Source Code

//package com.java2s;

public class Main {

    public static String removeMinusChar(String str) {
        return remove(str, '-');
    }//from  w w  w  . j a va 2 s.c  o  m

    public static String remove(String str, char remove) {
        if (isEmpty(str) || str.indexOf(remove) == -1) {
            return str;
        }
        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. removeBlanks(String content)
  2. rmvBlankLines(String input)
  3. remove(String str, char remove)
  4. removeCharacters(String x, char... cs)
  5. removeCommaChar(String str)
  6. removePhotoFromVCard(String vcard)
  7. removeQuotes(String ssid)
  8. removeSpaces(String string)
  9. removeSurplusSeparator(String str)