Package io.jans.as.model.util
Class StringUtils
- java.lang.Object
-
- io.jans.as.model.util.StringUtils
-
public class StringUtils extends Object
- Version:
- July 18, 2017
- Author:
- Javier Rojas Blum
-
-
Field Summary
Fields Modifier and Type Field Description static String
EASY_TO_READ_CHARACTERS
static String
EMPTY_STRING
static String
SPACE
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
addQueryStringParam(StringBuilder queryStringBuilder, String key, Object value)
static void
addQueryStringParam(StringBuilder queryStringBuilder, String key, Collection<?> value)
static String
base64urlencode(String string)
static boolean
equals(String str1, String str2)
Deprecated.it is possible to use directly: org.apache.commons.lang.StringUtils.equals(str1, str2);static boolean
equalsIgnoringSpaces(String a, String b)
static String
generateRandomCode(byte seedLength)
Generates a random code using a byte array as its seed.static String
generateRandomReadableCode(byte length)
Generates a code using a base of 20 characters easy to read for users, using parametrized length separated by dashes with intervals of 4 characters.static String
implode(String[] inputArray, String glueString)
Method to join array elements of type stringstatic String
implode(Collection<? extends Object> collection, String glueString)
Method to join a list of elements of type stringstatic String
implodeEnum(List<? extends HasParamName> inputList, String glueString)
static String
nullToEmpty(String str)
static Date
parseSilently(String string)
static List<String>
spaceSeparatedToList(String spaceSeparatedString)
static org.json.JSONArray
toJSONArray(List<? extends Object> inputList)
static List<String>
toList(org.json.JSONArray jsonArray)
-
-
-
Field Detail
-
EMPTY_STRING
public static final String EMPTY_STRING
- See Also:
- Constant Field Values
-
SPACE
public static final String SPACE
- See Also:
- Constant Field Values
-
EASY_TO_READ_CHARACTERS
public static final String EASY_TO_READ_CHARACTERS
- See Also:
- Constant Field Values
-
-
Method Detail
-
equals
@Deprecated public static boolean equals(String str1, String str2)
Deprecated.it is possible to use directly: org.apache.commons.lang.StringUtils.equals(str1, str2);Check if first and second String Params are equals, even if both are null.- Parameters:
str1
- first String paramstr2
- second String param- Returns:
- true if both are null, true if both are equals, false in other cases
-
implode
public static String implode(String[] inputArray, String glueString)
Method to join array elements of type string- Parameters:
inputArray
- Array which contains stringsglueString
- String between each array element- Returns:
- String containing all array elements separated by glue string.
-
implode
public static String implode(Collection<? extends Object> collection, String glueString)
Method to join a list of elements of type string- Parameters:
collection
- List which contains stringsglueString
- String between each array element- Returns:
- String containing all array elements separated by glue string.
-
implodeEnum
public static String implodeEnum(List<? extends HasParamName> inputList, String glueString)
-
toList
public static List<String> toList(org.json.JSONArray jsonArray) throws org.json.JSONException
- Throws:
org.json.JSONException
-
addQueryStringParam
public static void addQueryStringParam(StringBuilder queryStringBuilder, String key, Object value) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
addQueryStringParam
public static void addQueryStringParam(StringBuilder queryStringBuilder, String key, Collection<?> value) throws UnsupportedEncodingException
- Throws:
UnsupportedEncodingException
-
generateRandomReadableCode
public static String generateRandomReadableCode(byte length)
Generates a code using a base of 20 characters easy to read for users, using parametrized length separated by dashes with intervals of 4 characters.
-
generateRandomCode
public static String generateRandomCode(byte seedLength)
Generates a random code using a byte array as its seed.- Parameters:
seedLength
- Length of the byte array
-
-