Interface Strings
public interface Strings
String utility functions.
-
Field Summary
Fields -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic Stringfill(char ch, int len) Returns the string with a single repeated character to a specific length.static Stringformat(double x) Returns the string representation of a floating number with the minimum necessary precision.static Stringformat(float x) Returns the string representation of a floating number with the minimum necessary precision.static StringhtmlEscape(String input) Turn special characters into HTML character references.static StringhtmlEscape(String input, String encoding) Turn special characters into HTML character references.static booleanReturns true if the string is null or empty.static StringLeft pad a string with a specified character.static Stringordinal(int i) Returns the string representation of ordinal number with suffix.static double[]Parses a double array in format '[1.0, 2.0, 3.0]'.static int[]Parses an integer array in format '[1, 2, 3]'.static StringRight pad a string with a specified character.static StringUnescapes a string that contains standard Java escape sequences.
-
Field Details
-
DECIMAL_FORMAT
Decimal format for floating numbers.
-
-
Method Details
-
isNullOrEmpty
Returns true if the string is null or empty.- Parameters:
s- the string.- Returns:
- true if the string is null or empty.
-
unescape
-
htmlEscape
-
htmlEscape
-
ordinal
Returns the string representation of ordinal number with suffix.- Parameters:
i- the ordinal number.- Returns:
- the string representation of ordinal number with suffix.
-
leftPad
Left pad a string with a specified character.- Parameters:
s- the string to pad out, may be nullsize- the size to pad topadChar- the character to pad with- Returns:
- left padded String or original String if no padding is necessary, null if null String input
-
rightPad
Right pad a string with a specified character.- Parameters:
s- the string to pad out, may be nullsize- the size to pad topadChar- the character to pad with- Returns:
- left padded String or original String if no padding is necessary, null if null String input
-
fill
Returns the string with a single repeated character to a specific length.- Parameters:
ch- the character.len- the length of string.- Returns:
- the string.
-
format
Returns the string representation of a floating number with the minimum necessary precision.- Parameters:
x- a real number.- Returns:
- the string representation.
-
format
Returns the string representation of a floating number with the minimum necessary precision.- Parameters:
x- a real number.- Returns:
- the string representation.
-
parseIntArray
Parses an integer array in format '[1, 2, 3]'. Returns null if s is null or empty.- Parameters:
s- the string.- Returns:
- the array.
-
parseDoubleArray
Parses a double array in format '[1.0, 2.0, 3.0]'. Returns null if s is null or empty.- Parameters:
s- the string.- Returns:
- the array.
-