C# – How to insert a value in a string at certain positions c#


I have a program that gets a string from a method.
I want to know how to insert a string value to that string at certain positions.

For example:

mystring = "column1 in('a','b')column2 in('c','d')column3 in('e','f')";

Here, how would I insert the string value " and " after every occurance of the character ')' in mystring?

PS. If possible, also include how not to insert it right at the end.

Best Solution

Probably the simplest:

mystring = mystring.Replace(")", ") and ");
mystring = mystring.Substring(0, mystring.Length - " and ".Length);