Package com.stripe.util
Class StringUtils
java.lang.Object
com.stripe.util.StringUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsWhitespace(String str) Checks whether a string contains any whitespace characters or not.static booleansecureCompare(String a, String b) Compares two strings for equality.static StringtoSnakeCase(String str) Converts the string to snake case.static StringtrimApiVersion(String apiVersion) Trims the beta header part of an API Version string.
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
containsWhitespace
Checks whether a string contains any whitespace characters or not.- Parameters:
str- the string to check.- Returns:
trueif the string contains any whitespace characters; otherwise,false.
-
secureCompare
Compares two strings for equality. The time taken is independent of the number of characters that match.- Parameters:
a- one of the strings to compare.b- the other string to compare.- Returns:
- true if the strings are equal, false otherwise.
-
toSnakeCase
Converts the string to snake case.- Parameters:
str- the string to convert.- Returns:
- A string with the contents of the input string converted to snake case.
-
trimApiVersion
Trims the beta header part of an API Version string. For example, "2022-12-22; orders_beta=v3" is converted to "2022-12-22".- Parameters:
apiVersion- The API Version to trim. For example, "2022-12-22; orders_beta=v3".
-