Skip to content

Instantly share code, notes, and snippets.

@kamilklkn
Forked from enginkartal/js-turkish-to-english.js
Created November 28, 2020 06:51
Show Gist options
  • Save kamilklkn/554f7de95bf696db02014c677ae108ab to your computer and use it in GitHub Desktop.
Save kamilklkn/554f7de95bf696db02014c677ae108ab to your computer and use it in GitHub Desktop.
Javascript Turkish character to english characters change
String.prototype.turkishtoEnglish = function () {
return this.replace('Ğ','g')
.replace('Ü','u')
.replace('Ş','s')
.replace('I','i')
.replace('İ','i')
.replace('Ö','o')
.replace('Ç','c')
.replace('ğ','g')
.replace('ü','u')
.replace('ş','s')
.replace('ı','i')
.replace('ö','o')
.replace('ç','c');
};
// Example
// let text = 'Ne güzel bir gökkuşağı';
// newText = text.turkishtoEnglish();
// console.log(newText) /Ne guzel bir gokkusagi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment