T
tshad
I need to replace a value in a string that could be any case:
CREATE
Create
create
And I don't want to change the case of the whole string. Just find the work
"Create" and change it to "ALTER".
I am doing this way at the moment which works:
linePosition = textLine.ToUpper().IndexOf("CREATE");
if (linePosition > -1)
{
textLine = textLine.Replace(line.Substring(linePosition, 6), "ALTER");
}
I tried to do:
textLine = textLine.toupper().Replace("CREATE","ALTER");
But that changes the whole line to uppercase.
Is there a better way to do this?
Thanks,
Tom
CREATE
Create
create
And I don't want to change the case of the whole string. Just find the work
"Create" and change it to "ALTER".
I am doing this way at the moment which works:
linePosition = textLine.ToUpper().IndexOf("CREATE");
if (linePosition > -1)
{
textLine = textLine.Replace(line.Substring(linePosition, 6), "ALTER");
}
I tried to do:
textLine = textLine.toupper().Replace("CREATE","ALTER");
But that changes the whole line to uppercase.
Is there a better way to do this?
Thanks,
Tom