Hello all. I need to correct unwanted chars in a string. unwanted characters:
"c" instead of "ç" "i" instead of "ı" "u" instead of "ü" "g" instead of "ğ" "o" instead of "ö" "s" instead of "ş"
I have written this method. But it doesnt work.
public string UrlCorrection(string text)
{
text = (text.ToLower()).Trim();
var length = text.Length;
char chr;
string newtext="";
for (int i = 0; i < length; i++)
{
chr = text[i];
switch (chr)
{
case 'ç':
newtext = text.Replace("ç", "c");
break;
case 'ı':
newtext = text.Replace("ı", "i");
break;
case 'ü':
newtext = text.Replace("ü", "u");
break;
case 'ğ':
newtext = text.Replace("ğ", "g");
break;
case 'ö':
newtext = text.Replace("ö", "o");
break;
case 'ş':
newtext = text.Replace("ş", "s");
break;
default:
break;
}
}
newtext = text;
return text;
}
How do i implenet this task?