Blog Post by Murat Yaşar


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

Creating Connection and Making CRUD Operations From Your .NET Project to Oracle DB

Thursday, December 29, 2022 0   178  

Scratching Beneath the Surface

Friday, March 11, 2022 0   1564  

Calculate Time Difference Between Two Dates Excluding Weekend and Special Holidays

Monday, March 07, 2022 0   1443  

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

Saturday, September 01, 2018 1   2842   1

TCMB Mobile Applications

Friday, January 15, 2016 1   4468  

Some Helpful Links For Software Developers

Saturday, April 28, 2012 0   7617  

File Is Being Used By Another Process

Monday, August 29, 2011 1   3780  

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

Sunday, May 01, 2011 0   8238   5

LINQ

Friday, October 08, 2010 0   3216  

Debugging in .NET

Saturday, February 13, 2010 0   1914  

VS 2010 / .NET 4 Release Candidate

Tuesday, February 09, 2010 0   2164