Package eu.bandm.tools.util.java
Class Strings
java.lang.Object
eu.bandm.tools.util.java.Strings
Utility class for string manipulation.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
capitalize
(String s) Turns the very first character to upper case.static String
Compose two Strings with ".
" as the standard separator.static int
editDistance
(String s1, String s2) static String
Delivers easily readable String representation.static <T> String
iterableToString
(@Opt String openDelim, Iterable<T> elements, String separator, @Opt String closeDelim) Convert an Iterable into a string representation by applyingObject.toString()
to all elements and merging the results.static <T> String
iterableToString
(@Opt String openDelim, Iterable<T> elements, Function<T, String> fun, String separator, @Opt String closeDelim) Convert an Iterable into a string representation by applying the given function to all elements and merging the results.static String
Replace CR and CR-LF linefeed encodings by standard Unix newline, including preceding blanks.static String
Deliver the prefix of the given string of the given max length.static String
Deliver the prefix of the given string of the given max length.static String
removeQuotes
(String in) Remove the first and the last character in a string.static String
Replace LF, CR and CR-LF linefeed encodings, including preceding blanks, by one single blank.static String[]
splitByFirst
(String text) Takes the very first character as delimiter for splitting the rest of the string.static String
Turns the very first character to lower case.
-
Field Details
-
linefeedPattern
-
STANDARD_SUFFIX
Will be appended to a truncated string.- See Also:
-
-
Method Details
-
removeQuotes
Remove the first and the last character in a string. (Assuming that these are open and close quotations marks.) -
normalizeLinefeed
Replace CR and CR-LF linefeed encodings by standard Unix newline, including preceding blanks. -
replaceLinefeedByBlank
Replace LF, CR and CR-LF linefeed encodings, including preceding blanks, by one single blank. -
prefix
Deliver the prefix of the given string of the given max length. Append the suffix if the input has been truncated. -
prefix
Deliver the prefix of the given string of the given max length. Append theSTANDARD_SUFFIX
if the input has been truncated. -
hash32
Delivers easily readable String representation. -
compose
Compose two Strings with ".
" as the standard separator.- See Also:
-
uncapitalize
Turns the very first character to lower case. -
capitalize
Turns the very first character to upper case. -
splitByFirst
Takes the very first character as delimiter for splitting the rest of the string. The last character is ignored if it is the delimiter, so no empty sub-string is recognized at the end of the list. Is somehow equivalent to the xslt codesplitbyfirst
indoctypes/d2d_gp/libbasic.xslt
. -
iterableToString
public static <T> String iterableToString(@Opt @Opt String openDelim, Iterable<T> elements, String separator, @Opt @Opt String closeDelim) Convert an Iterable into a string representation by applyingObject.toString()
to all elements and merging the results. -
iterableToString
public static <T> String iterableToString(@Opt @Opt String openDelim, Iterable<T> elements, Function<T, String> fun, String separator, @Opt @Opt String closeDelim) Convert an Iterable into a string representation by applying the given function to all elements and merging the results. -
editDistance
-