Created
December 27, 2018 07:19
-
-
Save huantt/8dcb9537bf37a44163c50ebe8fb08b4a to your computer and use it in GitHub Desktop.
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
package x10adflex.growthhacking.common | |
import java.text.Normalizer | |
import java.util.regex.Pattern | |
/** | |
* @author huantt on 2018-12-27 | |
*/ | |
class AccentRemover { | |
static String remove(String str) { | |
try { | |
String temp = Normalizer.normalize(str, Normalizer.Form.NFD) | |
Pattern pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+") | |
return pattern.matcher(temp).replaceAll("") | |
} catch (Exception ex) { | |
ex.printStackTrace() | |
} | |
return "" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment