Package org.keycloak.utils
Class StringUtil
java.lang.Object
org.keycloak.utils.StringUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
static boolean
isNotBlank
(String str) static boolean
isNullOrEmpty
(String str) static String
joinValuesWithLogicalCondition
(String conditionText, Collection<String> values) Calling:static String
sanitizeSpacesAndQuotes
(String str, Character quotes) Utility method that substitutes any isWhitespace char to common space ' ' or character 20.
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
isBlank
-
isNotBlank
-
isNullOrEmpty
-
joinValuesWithLogicalCondition
public static String joinValuesWithLogicalCondition(String conditionText, Collection<String> values) Calling:joinValuesWithLogicalCondition("or", Arrays.asList("foo", "bar", "baz", "caz" ))
will return "foo, bar, baz or caz"- Parameters:
conditionText
- conditionvalues
- values to be joined with the condition at the end- Returns:
- see the example above
-
sanitizeSpacesAndQuotes
Utility method that substitutes any isWhitespace char to common space ' ' or character 20. The idea is removing any weird space character in the string like \t, \n, \r. If quotes character is passed the quotes char is escaped to mark is not the end of the value (for example escaped \" if quotes char " is found in the string).- Parameters:
str
- The string to normalizequotes
- The quotes to escape (for example " or '). It can be null.- Returns:
- The string without weird whitespaces and quotes escaped
-