String function ( String arg0 , String arg1 , String arg2 ) { if ( arg0 == null ) { return arg0 ; } int loc0 = arg0 . indexOf ( arg1 ) ; if ( loc0 >= 0 ) { String loc1 = arg0 . substring ( 0 , loc0 ) ; String loc2 = arg0 . substring ( loc0 + arg1 . length ( ) ) ; return loc1 + arg2 + loc2 ; } return arg0 ; }
replaces the first occurance of a string without reverting to regex or creating arrays/vectors etc could also have used stringutil for this perpose , but wanted something simpler . concode_field_sep PlaceHolder placeHolder concode_field_sep placeholderType placeHolder