Blog Post by Murat Yaşar


Posted on Sunday, December 19, 2010 1:29:36 PM and it has been read 853 times since then.


Converting String From Turkish To English

It is not the most perfect solution for this kind of conversion but I just wanted it to be found when I need a quick solution. I needed this for validating an e-mail address so here it is.

public static string getEnglishVersionOfTheString(string comingString)
{
    System.Text.StringBuilder ourResult = new System.Text.StringBuilder(comingString);

    if (comingString.Contains(@"Ğ") || comingString.Contains(@"ğ") ||
        comingString.Contains(@"Ü") || comingString.Contains(@"ü") ||
        comingString.Contains(@"İ") || comingString.Contains(@"Ş") ||
        comingString.Contains(@"ş") || comingString.Contains(@"ı") ||
        comingString.Contains(@"Ö") || comingString.Contains(@"ö") ||
        comingString.Contains(@"Ç") || comingString.Contains(@"ç"))
    {
        ourResult.Replace("Ğ", "G");
        ourResult.Replace("ğ", "g");
        ourResult.Replace("Ü", "U");
        ourResult.Replace("ü", "u");
        ourResult.Replace("İ", "I");
        ourResult.Replace("Ş", "S");
        ourResult.Replace("ş", "s");
        ourResult.Replace("ı", "i");
        ourResult.Replace("Ö", "O");
        ourResult.Replace("ö", "o");
        ourResult.Replace("Ç", "C");
        ourResult.Replace("ç", "c");
    }

    return ourResult.ToString();
}

Have a great day.


(In order to use this feature, you have to register.)

Tag Related Blog Entries

TCMB Mobile Applications

Friday, January 15, 2016 1   1933  

Some Helpful Links For Software Developers

Saturday, April 28, 2012 0   4321  

File Is Being Used By Another Process

Monday, August 29, 2011 1   1725  

Populate Nested TreeView In Asp.Net Using Common Table Expression In SQL Server

Sunday, May 01, 2011 0   4446   5

LINQ

Friday, October 08, 2010 0   1570  

Debugging in .NET

Saturday, February 13, 2010 0   964  

VS 2010 / .NET 4 Release Candidate

Tuesday, February 09, 2010 0   968