Skip to content

Instantly share code, notes, and snippets.

@mert-aydin
Last active September 13, 2021 16:01
Show Gist options
  • Save mert-aydin/4628a477fcc9cfc7dd8d97c8a82007e5 to your computer and use it in GitHub Desktop.
Save mert-aydin/4628a477fcc9cfc7dd8d97c8a82007e5 to your computer and use it in GitHub Desktop.
Replace Turkish characters to their English representations
fun String.toEnglishChars(): String {
var res = this
mapOf("Ç" to "C", "ç" to "c", "Ğ" to "G", "ğ" to "g", "İ" to "I", "ı" to "i", "Ö" to "O", "ö" to "o", "Ş" to "S", "ş" to "s", "Ü" to "U", "ü" to "u").entries.forEach { res = res.replace(it.key, it.value) }
return res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment