public static string Stuff(string cExpression, int nStartReplacement, int nCharactersReplaced, string cReplacement) { //Create a stringbuilder to work with the string StringBuilder sb = new StringBuilder(cExpression); if(nCharactersReplaced + nStartReplacement -1 >= cExpression.Length) nCharactersReplaced = cExpression.Length - nStartReplacement + 1; //First remove the characters specified in nCharacterReplaced if (nCharactersReplaced != 0) { sb.Remove(nStartReplacement - 1, nCharactersReplaced); } //Now Add the new string at the right location //sb.Insert(0,cExpression,nTimes); sb.Insert(nStartReplacement - 1,cReplacement); return sb.ToString(); }The link has the VB source code