Java String Sanitize sanitize(String string, boolean allowWhitespace)

Here you can find the source of sanitize(String string, boolean allowWhitespace)

Description

sanitize

License

Apache License

Declaration

public static String sanitize(String string, boolean allowWhitespace) 

Method Source Code

//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_]", "");
    }
}

Related

  1. sanitize(String s)
  2. sanitize(String s, boolean allowColorCodes)
  3. sanitize(String source)
  4. sanitize(String str)
  5. sanitize(String string)
  6. sanitize(String string, String spaceReplace)
  7. sanitize(String text)
  8. sanitize(String text)
  9. sanitize(String value)