Package uk.blankaspect.common.string
Class StringUtils
java.lang.Object
uk.blankaspect.common.string.StringUtils
This class contains utility methods that relate to strings and character
 sequences.
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThis is an enumeration of the ways in which an input string may be split by thesplit*(…)methods. - 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final charThe prefix that is recognised by theescape(CharSequence, String)method. - 
Method Summary
Modifier and TypeMethodDescriptionstatic StringapplyPrefix(String str, String prefix) static booleancontainsIgnoreCase(String target, Iterable<String> strs) static Stringescape(CharSequence seq, String metachars) extractLines(CharSequence text) Splits the specified text at line separators and returns the resulting list of lines.static Stringstatic Stringstatic Stringstatic Stringstatic intgetMaxLength(Iterable<? extends CharSequence> seqs) static intgetMaxLength(String... strs) static StringgetPrefixFirst(String str, char ch) static StringgetPrefixLast(String str, char ch) static StringgetSuffixAfterFirst(String str, char ch) static StringgetSuffixAfterLast(String str, char ch) static StringgetSuffixFirst(String str, char ch) static StringgetSuffixLast(String str, char ch) static intindexOfIgnoreCase(String target, List<String> strs) static booleanisNullOrBlank(String str) static booleanisNullOrEmpty(String str) Returnstrueif the specified string isnullor empty.static Stringjoin(char separator, boolean trailingSeparator, Iterable<? extends CharSequence> seqs) static Stringstatic Stringjoin(char separator, Iterable<? extends CharSequence> seqs) static Stringstatic Stringjoin(CharSequence separator, boolean trailingSeparator, Iterable<? extends CharSequence> seqs) static Stringjoin(CharSequence separator, boolean trailingSeparator, String... strs) static Stringjoin(CharSequence separator, Iterable<? extends CharSequence> seqs) static Stringjoin(CharSequence separator, String... strs) static StringpadAfter(CharSequence seq, int length) static StringpadAfter(CharSequence seq, int length, char ch) static StringpadBefore(CharSequence seq, int length) static StringpadBefore(CharSequence seq, int length, char ch) static StringremovePrefix(String str, String prefix) static StringremoveSuffix(String str, String suffix) static String[]splitAt(String str, int index, StringUtils.SplitMode splitMode) static String[]splitAtFirst(String str, char ch) static String[]splitAtFirst(String str, char ch, StringUtils.SplitMode splitMode) static String[]splitAtLast(String str, char ch) static String[]splitAtLast(String str, char ch, StringUtils.SplitMode splitMode) static StringstripAfter(CharSequence seq) static StringstripBefore(CharSequence seq) static StringtoCamelCase(CharSequence text) Converts the specified text to camel case and returns the resulting string.static Stringwrap(CharSequence seq, int maxLineLength) wrapLines(CharSequence seq, int maxLineLength)  
- 
Field Details
- 
ESCAPE_PREFIX_CHAR
public static final char ESCAPE_PREFIX_CHARThe prefix that is recognised by theescape(CharSequence, String)method.- See Also:
 
 
 - 
 - 
Method Details
- 
isNullOrEmpty
Returnstrueif the specified string isnullor empty.- Parameters:
 str- the string that will be tested.- Returns:
 trueifstrisnullor empty.
 - 
isNullOrBlank
- Parameters:
 str- the string that will be tested.- Returns:
 trueifstrisnullor empty or it contains only whitespace characters.
 - 
getMaxLength
 - 
getMaxLength
 - 
stripBefore
 - 
stripAfter
 - 
padBefore
 - 
padBefore
 - 
padAfter
 - 
padAfter
 - 
split
 - 
split
 - 
splitAt
 - 
splitAtFirst
 - 
splitAtFirst
 - 
splitAtLast
 - 
splitAtLast
 - 
getPrefixFirst
 - 
getPrefixLast
 - 
getSuffixFirst
 - 
getSuffixAfterFirst
 - 
getSuffixLast
 - 
getSuffixAfterLast
 - 
removePrefix
 - 
removeSuffix
 - 
join
 - 
join
 - 
join
 - 
join
 - 
join
 - 
join
public static String join(char separator, boolean trailingSeparator, Iterable<? extends CharSequence> seqs)  - 
join
 - 
join
public static String join(CharSequence separator, boolean trailingSeparator, Iterable<? extends CharSequence> seqs)  - 
extractLines
Splits the specified text at line separators and returns the resulting list of lines. The line separators that are recognised are CR+LF (U+000D, U+000A) and LF (U+000A). The line separators are not included in the output list.- Parameters:
 text- the text that will be split into lines at line separators.- Returns:
 - a list of the strings that result from splitting 
textat line separators. 
 - 
wrap
 - 
wrapLines
 - 
firstCharToLowerCase
 - 
firstCharsToLowerCase
 - 
firstCharToUpperCase
 - 
firstCharsToUpperCase
 - 
toCamelCase
Converts the specified text to camel case and returns the resulting string.The conversion is described below. In the description,
- a digit is a character for which 
Character.isDigit(char)returnstrue, - a letter is a character for which 
Character.isLetter(char)returnstrue, - a non-alphanumeric character is a character that is neither a digit nor a letter.
 
- Each letter that immediately follows a digit or a non-alphanumeric character is converted to upper case except for a letter that follows a sequence of a latter and an apostrophe (U+0027).
 - All other letters are converted to lower case.
 - All non-alphanumeric characters are removed.
 
- Parameters:
 text- the text that will be converted.- Returns:
 - the camel-case string that results from the conversion of 
text. 
 - a digit is a character for which 
 - 
applyPrefix
 - 
escape
 - 
containsIgnoreCase
 - 
indexOfIgnoreCase
 
 -