Here you can find the source of sanitize(String string, boolean allowWhitespace)
public static String sanitize(String string, boolean allowWhitespace)
//package com.java2s; //License from project: Apache License public class Main { public static String sanitize(String string, boolean allowWhitespace) { if (allowWhitespace) { return string.replaceAll("[^A-Za-z0-9_ ]", ""); }/* w w w .j a v a2s .c om*/ return string.replaceAll("[^A-Za-z0-9_]", ""); } }