public final class StringUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkCodeKey(String strCodeKey)
Check a code key.
Return true if each character of String is number lower case upper case |
static boolean |
checkEmail(String strEmail)
This function checks if an email is in a valid format Returns true if the email is valid
|
static boolean |
checkEmailAndDomainName(String strEmail,
String[] strBannedDomainNames)
This function checks if an email is in a valid format, and is not in a banned domain names list.
|
static boolean |
checkEmailDomainName(String strEmail,
String[] strBannedDomainNames)
Check if a domain name of an email address is not in a banned domain names list.
|
static boolean |
containsHtmlSpecialCharacters(String strValue)
Checks if a string literal contains any HTML special characters (&, ", ' <, >).
|
static boolean |
containsXssCharacters(String strValue)
Checks if a String contains characters that could be used for a cross-site scripting attack.
|
static boolean |
containsXssCharacters(String strValue,
char[] aXssCharacters)
Checks if a String contains characters that could be used for a cross-site scripting attack.
|
static boolean |
containsXssCharacters(String strValue,
String strXssCharacters)
Checks if a String contains characters that could be used for a cross-site scripting attack.
|
static int |
getIntValue(String strValue,
int nDefaultValue)
Converts
strValue to an int value. |
static String |
getXssCharactersAsString()
Simple convenience method to return the XSS characters as a string, to include it in error messages.
|
static boolean |
isAnyEmpty(String... strings)
Return true if any of the strings is empty, false otherwise
|
static String |
replaceAccent(String strSource)
This function converts French diacritics characters into non diacritics.
|
static String |
substitute(String strSource,
String strValue,
String strBookmark)
This function substitutes all occurences of a given bookmark by a given value
|
public static String substitute(String strSource, String strValue, String strBookmark)
strSource - The input string that contains bookmarks to replacestrValue - The value to substitute to the bookmarkstrBookmark - The bookmark namepublic static String replaceAccent(String strSource)
strSource - The String to convertpublic static boolean containsHtmlSpecialCharacters(String strValue)
strValue - The string literal to checkpublic static boolean containsXssCharacters(String strValue)
strValue - a character Stringpublic static boolean containsXssCharacters(String strValue, char[] aXssCharacters)
strValue - a character StringaXssCharacters - a Xss characters tab to check in strValuepublic static boolean containsXssCharacters(String strValue, String strXssCharacters)
strValue - a character StringstrXssCharacters - a String wich contain a list of Xss characters to check in strValuepublic static String getXssCharactersAsString()
public static boolean checkEmail(String strEmail)
strEmail - The mail to checkpublic static boolean checkEmailAndDomainName(String strEmail, String[] strBannedDomainNames)
strEmail - The mail to checkstrBannedDomainNames - The list of banned domain names. Domain names may start with a '@' or not.public static boolean checkEmailDomainName(String strEmail, String[] strBannedDomainNames)
strEmail - Email addresse to checkstrBannedDomainNames - List of banned domain namespublic static boolean checkCodeKey(String strCodeKey)
strCodeKey - The code Keypublic static int getIntValue(String strValue, int nDefaultValue)
strValue to an int value.strValue - the value to convertnDefaultValue - the default returned valuestrValue int value, nDefaultValue if strValue is not an Integer.public static boolean isAnyEmpty(String... strings)
strings - the strings to testCopyright © 2020 City of Paris. All rights reserved.