public static String replaceAnyOf ( String value , String chars , char replacement ) { char [ ] tmp = new char [ value . length ( ) ] ; int pos = 0 ; for ( int ix = 0 ; ix < tmp . length ; ix ++ ) { char ch = value . charAt ( ix ) ; if ( chars . indexOf ( ch ) != - 1 ) tmp [ pos ++ ] = replacement ; else tmp [ pos ++ ] = ch ; } return new String ( tmp , 0 , tmp . length ) ; }
Replaces all characters in the second parameter found in the first parameter with the final character .