question: public static String replace ( String str , String old_str , String new_str ) { int o = 0 ; StringBuilder buf = new StringBuilder ( ) ; for ( int i = str . indexOf ( old_str ) ; i > - 1 ; i = str . indexOf ( old_str , i + 1 ) ) { if ( i > o ) { buf . append ( str . substring ( o , i ) ) ; } buf . append ( new_str ) ; o = i + old_str . length ( ) ; } buf . append ( str . substring ( o , str . length ( ) ) ) ; return buf . toString ( ) ; }
target:  Replaces all occurrences of old_str in str with new_str