Skip to content

Instantly share code, notes, and snippets.

@hayatbiralem
Created November 23, 2016 15:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayatbiralem/4fca9158029b4678b9aa108774a8ff71 to your computer and use it in GitHub Desktop.
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.
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];
});
};
}
@ubeydeozdmr
Copy link

Çok teşekkürler, işe yaradı

@erduu777
Copy link

erduu777 commented Nov 4, 2023

Merhaba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment