Java Utililty Methods String Sanitize

List of utility methods to do String Sanitize

Description

The list of methods to do String Sanitize are organized into topic(s).

Method

StringsanitizeUserEmail(String userEmail)
Method sanitizeUserEmail cleans the userEmail from something like "john.ichat@rides.openfire/edbbeb61" to "john.ichat@rides.openfire"
String sanitizedUserEmail = null;
if (userEmail.contains("/")) {
    sanitizedUserEmail = userEmail.substring(0, userEmail.indexOf("/"));
} else {
    sanitizedUserEmail = userEmail;
return sanitizedUserEmail;
StringsanitizeUserName(final String userName)
sanitize User Name
if (userName != null) {
    return userName.replace('.', ' ');
return null;
StringsanitizeVersion(String inVer)
sanitize Version
return inVer.replaceAll(" ", "");
StringsanitizeWebOutput(String text)
sanitize Web Output
text = text.replaceAll("<", "&lt;");
return text;
intsanitizeYear(int yr)
sanitize year using the rule of 60, two digit ears >=60 = 1900+yr years less than 60 are 2000+yr.
if (yr >= 100)
    return yr;
if (yr >= 60 && yr < 100)
    return yr + 1900;
else if (yr < 60 && yr >= 0)
    return yr + 2000;
System.out.println("Illegal year to sanitize =" + yr);
return -1;
...