protected static String replaceAll(String s,String before,String after){
  int index=0;
  while (true) {
    int next=s.indexOf(before,index);
    if (next < 0) {
      return s;
    }
    s=s.substring(0,next) + after + s.substring(next + before.length());
    index=next + after.length();
  }
}

protected static String replaceAll ( String s , String before , String after ) { int index = 0 ; while ( true ) { int next = s . indexOf ( before , index ) ; if ( next < 0 ) { return s ; } s = s . substring ( 0 , next ) + after + s . substring ( next + before . length ( ) ) ; index = next + after . length ( ) ; } }
replace each substring in a given string . regular expression is not used .
