Skip to content

Instantly share code, notes, and snippets.

@Draww
Forked from onuryilmaz/ReplaceTurkishChars.java
Created October 12, 2019 10:03
Show Gist options
  • Save Draww/92802bcd8bc628a68c8ebfd436b3de0e to your computer and use it in GitHub Desktop.
Save Draww/92802bcd8bc628a68c8ebfd436b3de0e to your computer and use it in GitHub Desktop.
Replace Turkish Characters
public static String clearTurkishChars(String str) {
String ret = str;
char[] turkishChars = new char[] {0x131, 0x130, 0xFC, 0xDC, 0xF6, 0xD6, 0x15F, 0x15E, 0xE7, 0xC7, 0x11F, 0x11E};
char[] englishChars = new char[] {'i', 'I', 'u', 'U', 'o', 'O', 's', 'S', 'c', 'C', 'g', 'G'};
for (int i = 0; i < turkishChars.length; i++) {
ret = ret.replaceAll(new String(new char[]{turkishChars[i]}), new String(new char[]{englishChars[i]}));
}
return ret;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment