public final class MoreStrings extends Object
Modifier and Type | Method and Description |
---|---|
static String |
abbreviate(String s,
int width)
If string width exceeds passed parameter, replace string tail with dot-dot-dot.
|
static String |
capitalize(String str) |
static int |
compareStrings(String a,
String b)
Compare two strings lexicographically.
|
static boolean |
endsWithIgnoreCase(String str,
String suffix) |
static int |
getLevenshteinDistance(String str1,
String str2) |
static List<String> |
getSpellingSuggestions(String input,
Collection<String> options,
int maxDistance) |
static boolean |
isEmpty(CharSequence sequence) |
static com.google.common.collect.ImmutableList<String> |
lines(String data) |
static String |
linesToText(String... lines)
Joins the les passed in with the platform line separator.
|
static String |
regexPatternForAny(Iterable<String> values) |
static String |
regexPatternForAny(String... values) |
static Optional<String> |
stripPrefix(String s,
String prefix) |
static Optional<String> |
stripSuffix(String s,
String suffix) |
static String |
truncateMiddle(String data,
int keepFirstChars,
int keepLastChars) |
static String |
truncateMiddle(String data,
int keepFirstChars,
int keepLastChars,
String truncateMessage) |
static String |
truncatePretty(String data) |
static String |
truncateTail(String data,
int keepFirstChars) |
static String |
withoutSuffix(String str,
String suffix) |
public static String linesToText(String... lines)
lines
- the lines that need to be joined.public static boolean isEmpty(CharSequence sequence)
public static String truncateMiddle(String data, int keepFirstChars, int keepLastChars)
public static String truncateMiddle(String data, int keepFirstChars, int keepLastChars, String truncateMessage)
public static com.google.common.collect.ImmutableList<String> lines(String data) throws IOException
IOException
public static int compareStrings(String a, String b)
public static List<String> getSpellingSuggestions(String input, Collection<String> options, int maxDistance)
input
based on its Levenstein distance from a
list of available options
.