Java String Sanitize sanitize(String input)

Here you can find the source of sanitize(String input)

Description

Remove all characters except alphanumerics and space.

License

Open Source License

Declaration

public static String sanitize(String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from ww  w.jav  a2s  .  c om
     * Remove all characters except alphanumerics and space.
     * 
     * This is a pretty wild thing to do since it clears out tons of usually
     * useful stuff, like accent marks, punctuation, capitals..
     */
    public static String sanitize(String input) {
        return input.replaceAll("[^A-Za-z0-9 ]", " ");
    }
}

Related

  1. sanitize(double[] outdata)
  2. sanitize(final String main)
  3. sanitize(final String name)
  4. sanitize(final String s)
  5. sanitize(final String singleOctets, byte[] dest)
  6. sanitize(String input)
  7. sanitize(String input, String prohibitedStringsRegexp)
  8. sanitize(String methodHeader)
  9. sanitize(String mimeType)