Here you can find the source of slugify(String input)
public static String slugify(String input)
//package com.java2s; //License from project: Mozilla Public License import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.Locale; import java.util.regex.Pattern; public class Main { private static final Pattern NONLATIN = Pattern.compile("[^\\w-]"); private static final Pattern WHITESPACE = Pattern.compile("[\\s]"); public static String slugify(String input) { if (input == null) return ""; String nowhitespace = WHITESPACE.matcher(input).replaceAll("-"); String normalized = Normalizer.normalize(nowhitespace, Form.NFD); String slug = NONLATIN.matcher(normalized).replaceAll(""); return slug.toLowerCase(Locale.ENGLISH).replaceAll("--+", "-"); }//from w w w. j a v a 2 s .com }