java.lang.Object
io.lettuce.core.internal.LettuceStrings
public class LettuceStrings extends Object
Helper for
String checks. This class is part of the internal API and may change without further notice.- Since:
- 3.0
- Author:
- Mark Paluch
-
Method Summary
Modifier and Type Method Description static StringarrayToDelimitedString(Object[] arr, String delim)Convert aStringarray into a delimitedString(e.g.static StringcollectionToDelimitedString(Collection<?> coll, String delim, String prefix, String suffix)Convert aCollectionto a delimitedString(e.g.static booleanisEmpty(CharSequence cs)Checks if a CharSequence has a length of 0 or null.static booleanisEmpty(String cs)Checks if a String is empty or null.static booleanisNotEmpty(CharSequence cs)Checks if a CharSequence has a non-zero length and is not null.static booleanisNotEmpty(String cs)Checks if a String is not empty and not null.static Stringstring(double n)ConvertdoubletoString.static doubletoDouble(String s)ConvertStringtodouble.
-
Method Details
-
isEmpty
Checks if a String is empty or null.- Parameters:
cs- the char sequence- Returns:
- true if empty
- Since:
- 6.0.3
- See Also:
String.isEmpty()
-
isEmpty
Checks if a CharSequence has a length of 0 or null.- Parameters:
cs- the char sequence- Returns:
- true if empty
- See Also:
CharSequence.length()
-
isNotEmpty
Checks if a String is not empty and not null.- Parameters:
cs- the char sequence- Returns:
- true if not empty
- Since:
- 6.0.3
- See Also:
String.isEmpty()
-
isNotEmpty
Checks if a CharSequence has a non-zero length and is not null.- Parameters:
cs- the char sequence- Returns:
- true if not empty
- See Also:
CharSequence.length()
-
string
- Parameters:
n- the double.- Returns:
- string representation of
n
-
toDouble
ConvertStringtodouble. Ifsis +inf/-inf, returns positive/negative infinity. Ifsis +nan/-nan, returns NaN.- Parameters:
s- string representation of the number- Returns:
- the
doublevalue. - Since:
- 4.3.3
-
arrayToDelimitedString
Convert aStringarray into a delimitedString(e.g. CSV).Useful for
toString()implementations.- Parameters:
arr- the array to displaydelim- the delimiter to use (typically a ",")- Returns:
- the delimited
String
-
collectionToDelimitedString
public static String collectionToDelimitedString(Collection<?> coll, String delim, String prefix, String suffix)- Parameters:
coll- theCollectionto convertdelim- the delimiter to use (typically a ",")prefix- theStringto start each element withsuffix- theStringto end each element with- Returns:
- the delimited
String
-