Blog Post by Murat Yaşar


Posted on Sunday, December 19, 2010 1:29:36 PM and it has been read 1030 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

API For Getting Indicative Exchange Rates From Central Bank of the Republic of Turkey

Saturday, September 01, 2018 1   380   1

TCMB Mobile Applications

Friday, January 15, 2016 1   2259  

Some Helpful Links For Software Developers

Saturday, April 28, 2012 0   4718  

File Is Being Used By Another Process

Monday, August 29, 2011 1   2055  

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

Sunday, May 01, 2011 0   5043   5

LINQ

Friday, October 08, 2010 0   1718  

Debugging in .NET

Saturday, February 13, 2010 0   1059  

VS 2010 / .NET 4 Release Candidate

Tuesday, February 09, 2010 0   1106