Created
November 23, 2016 15:22
-
-
Save hayatbiralem/4fca9158029b4678b9aa108774a8ff71 to your computer and use it in GitHub Desktop.
Bir metin içindeki Türkçe karakterleri Latin karakterlere dönüştürür.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof String.prototype.toLatinFromTurkish !== "function") { | |
String.prototype.toLatinFromTurkish = function() { | |
var string = this; | |
var letters = { | |
"Ğ":"G", | |
"Ü":"U", | |
"Ş":"S", | |
"İ":"I", | |
"Ö":"O", | |
"Ç":"C", | |
"ğ":"g", | |
"ü":"u", | |
"ş":"s", | |
"ı":"i", | |
"ö":"o", | |
"ç":"c" | |
}; | |
return string.replace(/[ĞÜŞİÖÇğüşıöç]/g, function(letter) { | |
return letters[letter]; | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Çok teşekkürler, işe yaradı