public static String replaceChars(String str,String oldchars,char newchar){
  int pos=indexOfChars(str,oldchars);
  if (pos == -1) {
    return str;
  }
  StringBuilder buf=new StringBuilder(str);
  do {
    buf.setCharAt(pos,newchar);
    pos=indexOfChars(str,oldchars,pos + 1);
  }
 while (pos != -1);
  return buf.toString();
}

public static String replaceChars ( String str , String oldchars , char newchar ) { int pos = indexOfChars ( str , oldchars ) ; if ( pos == - 1 ) { return str ; } StringBuilder buf = new StringBuilder ( str ) ; do { buf . setCharAt ( pos , newchar ) ; pos = indexOfChars ( str , oldchars , pos + 1 ) ; } while ( pos != - 1 ) ; return buf . toString ( ) ; }
like string . replace ( ) except that it accepts any number of old chars . replaces any occurrances of ' oldchars ' in ' str ' with ' newchar ' . example : replacechars ( " hello , world ! " , " h , ! " , ' ' ) returns " ello world "
