public static String replace(String a,String b,String c){
  StringBuilder result=new StringBuilder(c.length());
  int i=0;
  int j=c.indexOf(a);
  while (j >= i) {
    result.append(c.substring(i,j));
    result.append(b);
    i=j + a.length();
    j=c.indexOf(a,i);
  }
  result.append(c.substring(i,c.length()));
  return result.toString();
}

public static String replace ( String a , String b , String c ) { StringBuilder result = new StringBuilder ( c . length ( ) ) ; int i = 0 ; int j = c . indexOf ( a ) ; while ( j >= i ) { result . append ( c . substring ( i , j ) ) ; result . append ( b ) ; i = j + a . length ( ) ; j = c . indexOf ( a , i ) ; } result . append ( c . substring ( i , c . length ( ) ) ) ; return result . toString ( ) ; }
replaces a with b in c .
