Removes all other characters from a string except digits.  A good way
of cleaing up something like a phone number.
@param str0 The string to clean up
@return A new String that has all characters except digits removed
973269
static public String removeAllCharsExceptDigits(String str0) {
        if (str0 == null) {
            return null;
        }
        if (str0.length() == 0) {
            return str0;
        }
        StringBuilder buf = new StringBuilder(str0.length());
        int length = str0.length();
        for (int i = 0; i < length; i++) {
            char c = str0.charAt(i);
            if (Character.isDigit(c)) {
                // append this character to our string
                buf.append(c);
            }
        }
        return buf.toString();
    }
860732
@Deprecated
	public static String removeChars(String S, char[] chars) {
		int pos;
		while((pos=indexOf(S, chars))!=-1) S=S.substring(0,pos)+S.substring(pos+1);
		return S;
	}
462982
public static String trimWhitespace(String str) {
        if (!hasLength(str)) {
            return str;
        }
        StringBuilder buf = new StringBuilder(str);
        while (buf.length() > 0 && Character.isWhitespace(buf.charAt(0))) {
            buf.deleteCharAt(0);
        }
        while (buf.length() > 0 && Character.isWhitespace(buf.charAt(buf.length() - 1))) {
            buf.deleteCharAt(buf.length() - 1);
        }
        return buf.toString();
    }
14728
public static String purge(String s) {
		StringBuilder out = new StringBuilder();
		for(int i = 0; i < s.length(); i ++) {
			char z = s.charAt(i);
			if (z < 256) {
				out.append(z);
			}			
		}
		return out.toString();
	}
1330258
public final String trimFrom(String s) {
    int first;
    int last;

    // removes leading matches
    for (first = 0; first < s.length(); ) {
      final int codePoint = s.codePointAt(first);
      if (!matches(codePoint)) {
        break;
      }
      first += Character.charCount(codePoint);
    }

    //remove trailing matches
    for (last = s.length() - 1; last >= first; --last) {
      if (Character.isLowSurrogate(s.charAt(last))) {
        --last;
      }
      if (!matches(s.codePointAt(last))) {
        break;
      }
    }

    return s.substring(first, last + 1);
  }
57048
static String stripLeadingHyphens(String str)
    {
        if (str == null)
        {
            return null;
        }
        if (str.startsWith("--"))
        {
            return str.substring(2, str.length());
        }
        else if (str.startsWith("-"))
        {
            return str.substring(1, str.length());
        }

        return str;
    }
241455
public static String removeAllWhitespaces(final String string) {
        if (string == null || string.length() == 0) {
            return string;
        }
        final int originalSize = string.length();
        final char[] charArray = new char[originalSize];
        int charCount = 0;
        for (int i = 0; i < originalSize; i++) {
            final char currentChar = string.charAt(i);
            if (!Character.isWhitespace(currentChar)) {
                charArray[charCount++] = currentChar;
            }
        }
        if (charCount == originalSize) {
            return string;
        }
        return new String(charArray, 0, charCount);
    }
1280723
public static String TraToSimplified( String str )
    {
        StringBuffer sb = new StringBuffer();
        int idx;
        for ( int j = 0; j < str.length(); j++ ) {
            if ( (idx = TRASTR.indexOf(str.charAt(j))) != -1 ) {
                sb.append(SIMSTR.charAt(idx));
            } else {
                sb.append(str.charAt(j));
            }
        }
        return sb.toString();
    }
458547
private String removeQuotes(String str) {
        if (str != null && !str.isEmpty()) {
            str = str.replaceAll("\"", "");
        }
        return str;
    }
226174
public static String deleteAny(String inString, String charsToDelete) {
        if (!hasLength(inString) || !hasLength(charsToDelete)) {
            return inString;
        }

        StringBuilder sb = new StringBuilder(inString.length());
        for (int i = 0; i < inString.length(); i++) {
            char c = inString.charAt(i);
            if (charsToDelete.indexOf(c) == -1) {
                sb.append(c);
            }
        }
        return sb.toString();
    }
537953
public static String stripNonNumber(String string)
    {
    	if (string == null)
    		return null;
        for (int i = 0; i < string.length(); i++)
        {
            char ch = string.charAt(i);
            if (!(Character.isDigit(ch)))
                if (ch != gchDot)
                if (ch != gchMinus)
                {
                    string = string.substring(0, i) + string.substring(i + 1);
                    i--;
                }
        }
        return string;
    }
862506
public static String toUpperFirstChar(final String str)
    {
        return Character.toUpperCase(str.charAt(0)) + str.substring(1);
    }
529343
private String removeAsterisk(String str)
   {
      if (str.startsWith("*"))
      {
         str = str.substring(1);
      }

      if (str.endsWith("*"))
      {
         str = str.substring(0, str.length() - 1);
      }

      return str;
   }
490187
static public String replaceString(String str, String strReplace,
			String strWith) {
		StringBuffer sb = new StringBuffer();
		int iCurrent = 0;
		int iFound;
		int iReplaceLen = strReplace.length();

		if (str == null || strReplace == null || strWith == null)
			return str;
		if (str.equals("") || strReplace.equals(""))
			return str;

		while (true) {
			iFound = str.indexOf(strReplace, iCurrent);
			if (iFound == -1) {
				sb.append(str.substring(iCurrent));
				break;
			}

			if (iFound != iCurrent)
				sb.append(str.substring(iCurrent, iFound));
			sb.append(strWith);
			iCurrent = iFound + iReplaceLen;
		}

		return sb.toString();
	}
278596
public String clean(String value) {
    String orig = value;
    
    // check if there's a + before the first digit
    boolean initialplus = findPlus(value);
    
    // remove everything but digits
    value = sub.clean(value);
    if (value == null)
      return null;

    // check for initial '00'
    boolean zerozero = !initialplus && value.startsWith("00");
    if (zerozero)
      value = value.substring(2); // strip off the zeros

    // look for country code
    CountryCode ccode = findCountryCode(value);
    if (ccode == null) {
      // no country code, let's do what little we can
      if (initialplus || zerozero)
        return orig; // this number is messed up. dare not touch
      return value;

    } else {
      value = value.substring(ccode.getPrefix().length()); // strip off ccode
      if (ccode.getStripZero() && value.startsWith("0"))
        value = value.substring(1); // strip the zero

      if (ccode.isRightFormat(value))
        return "+" + ccode.getPrefix() + " " + value;
      else
        return orig; // don't dare touch this
    }
  }
231373
public static String trimString(String string, int maxMessageLength) {
        if (string == null) {
            return null;
        } else if (string.length() > maxMessageLength) {
            // CHECKSTYLE.OFF: MagicNumber
            return string.substring(0, maxMessageLength - 3) + "...";
            // CHECKSTYLE.ON: MagicNumber
        } else {
            return string;
        }
    }
575555
public static String unCamelify(CharSequence original) {
		StringBuilder result = new StringBuilder(original.length());
		boolean wasLowercase = false;
		for (int i = 0; i < original.length(); i++) {
			char ch = original.charAt(i);
			if (Character.isUpperCase(ch) && wasLowercase) {
				result.append('-');
			}
			wasLowercase = Character.isLowerCase(ch);
			result.append(Character.toLowerCase(ch));
		}
		return result.toString();
	}