private static String checkAndReplaceCode(final String searchFor,final String replaceWith,String script){
  final int index=script.indexOf(searchFor);
  if (index != -1) {
    final StringBuilder buf=new StringBuilder(script.length());
    buf.append(script.substring(0,index));
    buf.append(replaceWith);
    buf.append(checkAndReplaceCode(searchFor,replaceWith,script.substring(index + searchFor.length(),script.length())));
    script=buf.toString();
  }
  return script;
}

private static String checkAndReplaceCode ( final String searchFor , final String replaceWith , String script ) { final int index = script . indexOf ( searchFor ) ; if ( index != - 1 ) { final StringBuilder buf = new StringBuilder ( script . length ( ) ) ; buf . append ( script . substring ( 0 , index ) ) ; buf . append ( replaceWith ) ; buf . append ( checkAndReplaceCode ( searchFor , replaceWith , script . substring ( index + searchFor . length ( ) , script . length ( ) ) ) ) ; script = buf . toString ( ) ; } return script ; }
replace the searchfor string with the replacewith string within the code specified
