Turkish character lowercase and uppercase functions

String.prototype.turkishToLower = function(){

var string = this;

var letters = { İ: i, I: ı, Ş: ş, Ğ: ğ, Ü: ü, Ö: ö, Ç: ç };

string = string.replace(/(([İIŞĞÜÇÖ]))/g, function(letter){ return letters[letter]; })

return string.toLowerCase(); }

String.prototype.turkishToUpper = function(){

String.prototype.turkishToUpper = function(){

var string = this;

var letters = { i: İ, ş: Ş, ğ: Ğ, ü: Ü, ö: Ö, ç: Ç, ı: I };

string = string.replace(/(([iışğüçö]))/g, function(letter){ return letters[letter]; })

return string.toUpperCase();}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: