Java String Sanitize sanitizeID(String name)

Here you can find the source of sanitizeID(String name)

Description

sanitize ID

License

Apache License

Declaration

public static String sanitizeID(String name) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String sanitizeID(String name) {
        name = name.replaceAll("[^a-zA-Z0-9_\\-\\.]", "_");
        if (name.matches("([0-9]|\\.|\\-).*"))
            name = "a" + name;
        return name;
    }/*from  www  . j  a v a2 s. c  o m*/
}

Related

  1. sanitizeForTableName(String input)
  2. sanitizeForUri(String uri, String replace)
  3. sanitizeFullPrefixKey(String propKey)
  4. sanitizeGoogleId(String rawGoogleId)
  5. sanitizeHeader(String header)
  6. sanitizeIdentifier(String identifier)
  7. sanitizeIdentifierName(String input)
  8. sanitizeIDs(String str)
  9. sanitizeInput(String input)