Skip to content

Instantly share code, notes, and snippets.

@ricardodestro
Created August 9, 2016 21:00
Show Gist options
  • Save ricardodestro/49fc321de2218477cd7b8b780015a2aa to your computer and use it in GitHub Desktop.
Save ricardodestro/49fc321de2218477cd7b8b780015a2aa to your computer and use it in GitHub Desktop.
/**
* Normaliza string
*
* @param s
* @return
*/
public static String normalize(String s) {
return Normalizer.normalize(s, Form.NFD).toLowerCase().replaceAll("\\p{P}", "").replaceAll("\\s+", "-")
.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment