public static String cleanString ( String pStr ) { if ( pStr == null || pStr . equals ( "" ) ) { return pStr ; } StringBuffer buff = new StringBuffer ( ) ; for ( int i = 0 ; i < pStr . length ( ) ; i ++ ) { char aChar = pStr . charAt ( i ) ; if ( Character . isLetterOrDigit ( aChar ) ) { buff . append ( aChar ) ; } } return buff . toString ( ) ; }
Removes all the spcial charactes and spaces from the passed in string - none letters or digits .