Java String Sanitize sanitize(final String main)

Here you can find the source of sanitize(final String main)

Description

Removes all chars not accepted by the file system naming scheme.

License

Open Source License

Parameter

Parameter Description
main a parameter

Declaration

public static String sanitize(final String main) 

Method Source Code

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

public class Main {
    /**// w w w . j a  va 2  s. c  om
     * Removes all chars not accepted by the file system naming scheme.
     * 
     * @param main
     * @return
     */
    public static String sanitize(final String main) {
        return main.replace("<", "").replace(">", "").replace(":", "")
                .replace("/", "").replace("\\", "").replace("|", "")
                .replace("?", "").replace("*", "").replace("\"", "")
                .replace("\r", "").replace("\n", "");
    }
}

Related

  1. sanitize(char orig)
  2. sanitize(CharSequence string)
  3. sanitize(double[] outdata)
  4. sanitize(final String name)
  5. sanitize(final String s)
  6. sanitize(final String singleOctets, byte[] dest)
  7. sanitize(String input)