Class StringUtils
java.lang.Object
com.amazonaws.util.StringUtils
Utilities for converting objects to strings.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendCompactedString(StringBuilder destination, String source) This method appends a string to a string builder and collapses contiguous white space is a single space.static booleanbeginsWithIgnoreCase(String data, String seq) Performs a case insensitive comparison and returns true if the data begins with the given sequence.static intCompare two strings with Locale.ENGLISH This method is preferred over String.compareTo() method.static StringfromBigDecimal(BigDecimal value) static StringfromBigInteger(BigInteger value) static StringfromBoolean(Boolean value) static StringReturns the string representation of the specified Byte.static StringfromByteBuffer(ByteBuffer byteBuffer) Base64 encodes the data in the specified byte buffer (from the current position to the buffer's limit) and returns it as a base64 encoded string.static StringConverts the specified date to an ISO 8601 timestamp string and returns it.static StringfromDouble(Double d) Returns the string representation of the specified double.static Stringstatic StringfromInteger(Integer value) static Stringstatic StringfromString(String value) static booleanisNullOrEmpty(String value) static StringJoins the strings in parts with joiner between each stringstatic StringConverts a given String to lower case with Locale.ENGLISHstatic Stringstatic BigDecimalstatic BigIntegerstatic BooleantoBoolean(StringBuilder value) static IntegertoInteger(StringBuilder value) static StringtoString(StringBuilder value) static StringA null-safe trim method.static StringConverts a given String to upper case with Locale.ENGLISH
-
Field Details
-
COMMA_SEPARATOR
- See Also:
-
UTF8
-
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
toInteger
-
toString
-
toBoolean
-
fromInteger
-
fromLong
-
fromString
-
fromBoolean
-
fromBigInteger
-
fromBigDecimal
-
toBigInteger
-
toBigDecimal
-
fromFloat
-
fromDate
-
fromDouble
-
fromByte
-
fromByteBuffer
Base64 encodes the data in the specified byte buffer (from the current position to the buffer's limit) and returns it as a base64 encoded string.- Parameters:
byteBuffer- The data to base64 encode and return as a string; must not be null.- Returns:
- The base64 encoded contents of the specified byte buffer.
-
replace
-
join
-
trim
-
isNullOrEmpty
- Returns:
- true if the given value is either null or the empty string
-
lowerCase
-
upperCase
-
compare
Compare two strings with Locale.ENGLISH This method is preferred over String.compareTo() method.- Parameters:
str1- String 1str2- String 2- Returns:
- negative integer if str1 lexicographically precedes str2 positive integer if str1 lexicographically follows str2 0 if both strings are equal
- Throws:
IllegalArgumentException- throws exception if both or either of the strings is null
-
appendCompactedString
This method appends a string to a string builder and collapses contiguous white space is a single space. This is equivalent to: destination.append(source.replaceAll("\\s+", " ")) but does not create a Pattern object that needs to compile the match string; it also prevents us from having to make a Matcher object as well. -
beginsWithIgnoreCase
-