Created
April 28, 2012 21:34
-
-
Save mourawaldson/2522200 to your computer and use it in GitHub Desktop.
Remove accents
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
import java.text.Normalizer; | |
/** | |
* Remove a acentuação de uma String. | |
* | |
* @param str | |
* @return String sem acentos. | |
*/ | |
public static String removeAccents(String str) { | |
str = Normalizer.normalize(str, Normalizer.Form.NFD); | |
return str.replaceAll("[^\\p{ASCII}]", ""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment