CS vs. case-insensitive CI through a singleton instance.
CharSequenceUtils, StringUtils
| Modifier and Type | Class and Description |
|---|---|
| public static class | Strings.
Builds |
| private static class | Strings.
Case-insensitive extension. |
| private static class | Strings.
Case-sentive extension. |
| Modifier and Type | Field and Description |
|---|---|
| public static final Strings | CI
The Case-Insensitive singleton instance. |
| public static final Strings | CS
The Case-Sensitive singleton instance. |
| private final boolean | ignoreCase
Ignores case when possible. |
| private final boolean | nullIsLess
Compares null as less when possible. |
| Access | Constructor and Description |
|---|---|
| private | Strings(final boolean
Ignores case when possible. ignoreCase, final boolean Compares null as less when possible. nullIsLess)Constructs a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| public String | Returns: A new String if suffix was appended, the same string otherwise.The string. str, final CharSequence The suffix to append to the end of the string. suffix, final CharSequence... Additional suffixes that are valid terminators (optional). suffixes)Appends the suffix to the end of the string if the string does not already end with the suffix. |
| public static final Strings. | |
| public abstract int | Returns: < 0, 0, > 0, ifstr1 is respectively less, equal or greater than str2the String to compare from str1, String the String to compare to str2)Compare two Strings lexicographically, like |
| public abstract boolean | Returns: true if the CharSequence contains the search CharSequence, false if not ornull string inputthe CharSequence to check, may be null seq, CharSequence the CharSequence to find, may be null searchSeq)Tests if CharSequence contains a search CharSequence, handling |
| private static boolean | Returns: true if any of the search CharSequences are found, false otherwiseThe CharSequence to check, may be null cs, final CharSequence... The array of CharSequences to search for, may be null. Individual CharSequences may be null as well. searchCharSequences)Tests if the CharSequence contains any of the CharSequences in the given array. |
| public boolean | Returns: true if any of the search CharSequences are found, false otherwiseThe CharSequence to check, may be null cs, final CharSequence... The array of CharSequences to search for, may be null. Individual CharSequences may be null as well. searchCharSequences)Tests if the CharSequence contains any of the CharSequences in the given array. |
| public boolean | Returns: true if the CharSequence starts with the prefix or both null.the CharSequence to check, may be null. str, final CharSequence the suffix to find, may be null. suffix)Tests if a CharSequence ends with a specified suffix. |
| public boolean | Returns: true if the input sequence is null AND no searchStrings are provided, or the input sequence ends in any
of the provided searchStrings.the CharSequence to check, may be null sequence, final CharSequence... the CharSequence suffixes to find, may be empty or contain searchStrings)nullTests if a CharSequence ends with any of the provided suffixes. |
| private static boolean | |
| public abstract boolean | Returns: true if the CharSequences are equal (case-sensitive), or both nullthe first CharSequence, may be cs1, CharSequence nullthe second CharSequence, may be cs2)nullCompares two CharSequences, returning |
| public abstract boolean | |
| public boolean | Returns: true if the string is equal (case-sensitive) to any other element of searchStrings; false if searchStrings is
null or contains no matches.to compare, may be string, final CharSequence... null.a vararg of strings, may be searchStrings)null.Compares given |
| public int | Returns: the first index of the search CharSequence, -1 if no match ornull string inputthe CharSequence to check, may be null seq, final CharSequence the CharSequence to find, may be null searchSeq)Finds the first index within a CharSequence, handling |
| public abstract int | Returns: the first index of the search CharSequence (always ≥ startPos), -1 if no match ornull string inputthe CharSequence to check, may be null seq, CharSequence the CharSequence to find, may be null searchSeq, int the start position, negative treated as zero startPos)Finds the first index within a CharSequence, handling |
| public boolean | |
| pack-priv boolean | Returns: whether null is less when comparing.Tests whether null is less when comparing. |
| public int | Returns: the last index of the search String, -1 if no match ornull string inputthe CharSequence to check, may be null str, final CharSequence the CharSequence to find, may be null searchStr)Finds the last index within a CharSequence, handling |
| public abstract int | Returns: the last index of the search CharSequence (always ≤ startPos), -1 if no match ornull string inputthe CharSequence to check, may be null seq, CharSequence the CharSequence to find, may be null searchSeq, int the start position, negative treated as zero startPos)Finds the last index within a CharSequence, handling |
| public String | Returns: A new String if prefix was prepended, the same string otherwise.The string. str, final CharSequence The prefix to prepend to the start of the string. prefix, final CharSequence... Additional prefixes that are valid. prefixes)Prepends the prefix to the start of the string if the string does not already start with any of the prefixes. |
| public String | |
| public String | Returns: the substring with the string removed if found,null if null String inputthe source String to search, may be null str, final CharSequence the String to search for (case-insensitive) and remove, may be null remove)Case-insensitive removal of a substring if it is at the end of a source string, otherwise returns the source string. |
| public String | Returns: the substring with the string removed if found,null if null String inputthe source String to search, may be null str, final CharSequence the String to search for (case-insensitive) and remove, may be null remove)Case-insensitive removal of a substring if it is at the beginning of a source string, otherwise returns the source string. |
| public String | Returns: the text with any replacements processed,null if null String inputtext to search and replace in, may be null text, final String the String to search for (case-insensitive), may be null searchString, final String the String to replace it with, may be null replacement)Case insensitively replaces all occurrences of a String within another String. |
| public String | Returns: the text with any replacements processed,null if null String inputtext to search and replace in, may be null text, String the String to search for (case-insensitive), may be null searchString, final String the String to replace it with, may be null replacement, int maximum number of values to replace, or max)-1 if no maximumReplaces a String with another String inside a larger String, for the first |
| public String | Returns: the text with any replacements processed,null if null String inputtext to search and replace in, may be null text, final String the String to search for, may be null searchString, final String the String to replace with, may be null replacement)Replaces a String with another String inside a larger String, once. |
| public boolean | Returns: true if the CharSequence starts with the prefix, case-sensitive, or both nullthe CharSequence to check, may be null str, final CharSequence the prefix to find, may be null prefix)Tests if a CharSequence starts with a specified prefix. |
| public boolean | Returns: true if the input sequence is null AND no searchStrings are provided, or the input sequence begins with
any of the provided searchStrings.the CharSequence to check, may be null sequence, final CharSequence... the CharSequence prefixes, may be empty or contain searchStrings)nullTests if a CharSequence starts with any of the provided prefixes. |