I currently have the code below, to replace a characters in a string but I now need to replace characters within the first X (in this case 3) characters and leave the rest of the string. In my example below I have 51115 but I need to replace any 5 within the first 3 characters and I should end up with 61115.
My current code:
value = 51115;
oldString = 5;
newString = 6;
result = Regex.Replace(value.ToString(), oldString, newString, RegexOptions.IgnoreCase);
result is now 61116. What would you suggest I do to query just the first x characters?
Thanks