question: public static String replace ( String str , char oldChar , String newStr ) { StringBuffer buf = new StringBuffer ( ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { char ch = str . charAt ( i ) ; if ( ch == oldChar ) { buf . append ( newStr ) ; } else { buf . append ( ch ) ; } } return buf . toString ( ) ; }
target:  Returns a string with all occurrences of oldChar replaced by newStr