Replacing a substring at a specific position
Hi all, need some help.
I want to replace the second character in a string, regardless of what character that is.
If I try the replace the second character with the (substring 1, 1) all instances of that character gets replaced.
I just want to replace the one sitting at position 2 in the string.
Ex Good -> Gxod, not Gxxd
Thanks in advance
why not use LEFT and MID ?
Why couldn't you just use ...
newstring = LEFT(oldstring, 1) & newcharacter & MID(oldstring, 3)
C# replace specific character
A bit of filthy wat to do it, but it works.
string editString = "Good";
StringBuilder sb = new StringBuilder(editString);
editString = sb.ToString();