Created
March 27, 2014 18:08
-
-
Save mmahadevan-okta/9814282 to your computer and use it in GitHub Desktop.
sanitizeUsername
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String sanitizeUsername(String name) { | |
LOGGER.debug("sanitizeUsername(" + name + ")"); | |
if ( ! StringUtils.containsOnly(name.toUpperCase(), "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789#$_@")) { | |
name = name.replaceAll("[^A-Za-z0-9\\#\\$\\_\\@]", ""); | |
} | |
LOGGER.debug("sanitized to [" + name + "]"); | |
return name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment