public static String insert ( String haystack , String needle , int index ) { StringBuffer val = new StringBuffer ( haystack ) ; val . insert ( index , needle ) ; return val . toString ( ) ; }
replaces the first occurrence of needle in haystack with newNeedle