Package io.lettuce.core.internal
Class LettuceStrings
- java.lang.Object
-
- io.lettuce.core.internal.LettuceStrings
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
arrayToDelimitedString(Object[] arr, String delim)
Convert aString
array into a delimitedString
(e.g.static String
collectionToDelimitedString(Collection<?> coll, String delim, String prefix, String suffix)
Convert aCollection
to a delimitedString
(e.g.static boolean
isEmpty(CharSequence cs)
Checks if a CharSequence has a length of 0 or null.static boolean
isEmpty(String cs)
Checks if a String is empty or null.static boolean
isNotEmpty(CharSequence cs)
Checks if a CharSequence has a non-zero length and is not null.static boolean
isNotEmpty(String cs)
Checks if a String is not empty and not null.static String
string(double n)
Convertdouble
toString
.static char[]
toCharArray(CharSequence seq)
Return achar[]
from the giveCharSequence
.static double
toDouble(String s)
ConvertString
todouble
.
-
-
-
Method Detail
-
isEmpty
public static boolean isEmpty(String cs)
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
public static boolean isEmpty(CharSequence cs)
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
public static boolean isNotEmpty(String cs)
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
public static boolean isNotEmpty(CharSequence cs)
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
public static String string(double n)
- Parameters:
n
- the double.- Returns:
- string representation of
n
-
toDouble
public static double toDouble(String s)
ConvertString
todouble
. Ifs
is +inf/-inf, returns positive/negative infinity. Ifs
is +nan/-nan, returns NaN.- Parameters:
s
- string representation of the number- Returns:
- the
double
value. - Since:
- 4.3.3
-
arrayToDelimitedString
public static String arrayToDelimitedString(Object[] arr, String delim)
Convert aString
array 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
- theCollection
to convertdelim
- the delimiter to use (typically a ",")prefix
- theString
to start each element withsuffix
- theString
to end each element with- Returns:
- the delimited
String
-
toCharArray
public static char[] toCharArray(CharSequence seq)
Return achar[]
from the giveCharSequence
.- Parameters:
seq
- the sequence to read- Returns:
- the character array
- Since:
- 6.2
-
-