private static String replace ( String source , char oldChar , String newString ) { StringBuilder StringBuilder = new StringBuilder ( source . length ( ) ) ; for ( int i = 0 ; i < source . length ( ) ; i ++ ) { char c = source . charAt ( i ) ; if ( c == oldChar ) { StringBuilder . append ( newString ) ; } else { StringBuilder . append ( c ) ; } } return StringBuilder . toString ( ) ; }
Replaces any occurnace of the specified oldChar with the nes string .