Get Alpha Numeric String

Return a String stripped of all characters except for Alpha or Numeric characters only.

Javadoc available at https://www.javatapas.com/docs/javatapas/string/GetAlphaNumericString.html


public static String getAlphaNumericString(String inStr){

	StringBuilder sb = new StringBuilder();
	char[] chars = inStr.toLowerCase().toCharArray();

	for (int i = 0; i < chars.length; i++){
		if ((chars[i] >= '0' && chars[i] <= '9') || (chars[i] >= 'a' && chars[i] <= 'z')){sb.append(chars[i]);}
	}

	return sb.toString();

}