question: public static String replace ( String input , String find , String repl , boolean firstOnly , boolean ignoreCase ) { int findLen = find . length ( ) ; if ( findLen == 0 ) return input ; if ( ! ignoreCase && findLen == repl . length ( ) ) { if ( find . equals ( repl ) ) return input ; if ( ! firstOnly && findLen == 1 ) return input . replace ( find . charAt ( 0 ) , repl . charAt ( 0 ) ) ; } int pos = ignoreCase ? indexOfIgnoreCase ( input , find ) : input . indexOf ( find ) ; if ( pos == - 1 ) return input ; int start = 0 ; StringBuilder sb = new StringBuilder ( repl . length ( ) > find . length ( ) ? ( int ) Math . ceil ( input . length ( ) * 1.2 ) : input . length ( ) ) ; while ( pos != - 1 ) { sb . append ( input . substring ( start , pos ) ) ; sb . append ( repl ) ; start = pos + findLen ; if ( firstOnly ) break ; pos = ignoreCase ? indexOfIgnoreCase ( input , find , start ) : input . indexOf ( find , start ) ; } if ( input . length ( ) > start ) sb . append ( input . substring ( start ) ) ; return sb . toString ( ) ; }
target:  performs a replace operation on a string