Package net.adoptopenjdk.icedteaweb
Class StringUtils
- java.lang.Object
-
- net.adoptopenjdk.icedteaweb.StringUtils
-
public class StringUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringEMPTY_STRING
-
Constructor Summary
Constructors Modifier Constructor Description privateStringUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanhasPrefixMatch(java.lang.String heyStack, java.lang.String... candidates)If a candidate is a prefix of the heyStack, then this is a match.static booleanisBlank(java.lang.String str)Determines whether a given string isnull, empty, or only contains whitespace.static java.util.List<java.lang.String>splitIntoMultipleLines(java.lang.String s, int maxCharsPerLine)Method for splitting long strings into multiple lines.static java.lang.StringsubstringBeforeLast(java.lang.String s, java.lang.String separator)static java.lang.StringurlEncode(java.lang.String s)
-
-
-
Field Detail
-
EMPTY_STRING
public static final java.lang.String EMPTY_STRING
- See Also:
- Constant Field Values
-
-
Method Detail
-
isBlank
public static boolean isBlank(java.lang.String str)
Determines whether a given string is
null, empty, or only contains whitespace. If it contains anything other than whitespace then the string is not considered to be blank and the method returnsfalse.- Parameters:
str- The string to test.- Returns:
trueif the string isnull, or blank.
-
splitIntoMultipleLines
public static java.util.List<java.lang.String> splitIntoMultipleLines(java.lang.String s, int maxCharsPerLine)Method for splitting long strings into multiple lines. This is mainly used for pretty printing. Whitespace characters in the input string are not handled specially.All lines will have the length passed as
maxCharsPerLineexcept the last one which may be shorter.If null is passed instead of a string then an empty list is returned. If zero or a negative maxCharsPerLine is passed then a list containing the input string as the only element is returned.
- Parameters:
s- the string to be split into multiple linesmaxCharsPerLine- the maximum characters a line may contain.- Returns:
- a list of strings with the maximal length as specified.
-
hasPrefixMatch
public static boolean hasPrefixMatch(java.lang.String heyStack, java.lang.String... candidates)If a candidate is a prefix of the heyStack, then this is a match. If no candidates are specified, it matches any heyStack.- Parameters:
heyStack- the string to match candidates againstcandidates- the strings to test as possible prefixes- Returns:
- true if the any of the candidates is a prefix match of the heystack or if there are no candidates.
-
substringBeforeLast
public static java.lang.String substringBeforeLast(java.lang.String s, java.lang.String separator)
-
urlEncode
public static java.lang.String urlEncode(java.lang.String s)
-
-