public class ManCharSequenceExt extends Object
| Constructor and Description |
|---|
ManCharSequenceExt() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
all(CharSequence thiz,
CharPredicate predicate) |
static boolean |
contains(CharSequence thiz,
char ch) |
static boolean |
contains(CharSequence thiz,
char ch,
boolean ignoreCase)
Returns `true` if this char sequence contains the specified character [char].
|
static boolean |
contains(CharSequence thiz,
CharSequence other) |
static boolean |
contains(CharSequence thiz,
CharSequence other,
boolean ignoreCase)
Returns `true` if this char sequence contains the specified [other] sequence of characters as a substring.
|
static boolean |
endsWith(CharSequence thiz,
char c)
Returns `true` if this char sequence ends with the specified character.
|
static boolean |
endsWith(CharSequence thiz,
CharSequence suffix)
Returns `true` if this char sequence ends with the specified suffix.
|
static boolean |
endsWithIgnoreCase(CharSequence thiz,
char c) |
static boolean |
endsWithIgnoreCase(CharSequence thiz,
CharSequence suffix)
Returns `true` if this char sequence ends with the specified prefix.
|
static Pair<Integer,String> |
findAnyOf(CharSequence thiz,
Collection<String> strings) |
static Pair<Integer,String> |
findAnyOf(CharSequence thiz,
Collection<String> strings,
int startIndex) |
static Pair<Integer,String> |
findAnyOf(CharSequence thiz,
Collection<String> strings,
int startIndex,
boolean ignoreCase)
Finds the first occurrence of any of the specified [strings] in this char sequence,
starting from the specified [startIndex] and optionally ignoring the case.
|
static Pair<Integer,String> |
findLastAnyOf(CharSequence thiz,
Collection<String> strings) |
static Pair<Integer,String> |
findLastAnyOf(CharSequence thiz,
Collection<String> strings,
int startIndex) |
static Pair<Integer,String> |
findLastAnyOf(CharSequence thiz,
Collection<String> strings,
int startIndex,
boolean ignoreCase)
Finds the last occurrence of any of the specified [strings] in this char sequence,
starting from the specified [startIndex] and optionally ignoring the case.
|
static char |
first(CharSequence thiz) |
static int |
indexOf(CharSequence thiz,
int ch) |
static int |
indexOf(CharSequence thiz,
int ch,
boolean ignoreCase) |
static int |
indexOf(CharSequence thiz,
int ch,
int startIndex) |
static int |
indexOf(CharSequence thiz,
int ch,
int startIndex,
boolean ignoreCase)
Returns the index within this string of the first occurrence of the specified character, starting from the specified [startIndex].
|
static int |
indexOf(CharSequence thiz,
String string) |
static int |
indexOf(CharSequence thiz,
String string,
boolean ignoreCase) |
static int |
indexOf(CharSequence thiz,
String string,
int startIndex) |
static int |
indexOf(CharSequence thiz,
String string,
int startIndex,
boolean ignoreCase)
Returns the index within this char sequence of the first occurrence of the specified [string],
starting from the specified [startIndex].
|
static int |
indexOfAny(CharSequence thiz,
char[] chars) |
static int |
indexOfAny(CharSequence thiz,
char[] chars,
int startIndex) |
static int |
indexOfAny(CharSequence thiz,
char[] chars,
int startIndex,
boolean ignoreCase)
Finds the index of the first occurrence of any of the specified [chars] in this char sequence,
starting from the specified [startIndex] and optionally ignoring the case.
|
static int |
indexOfAny(CharSequence thiz,
Collection<String> strings) |
static int |
indexOfAny(CharSequence thiz,
Collection<String> strings,
int startIndex) |
static int |
indexOfAny(CharSequence thiz,
Collection<String> strings,
int startIndex,
boolean ignoreCase)
Finds the index of the first occurrence of any of the specified [strings] in this char sequence,
starting from the specified [startIndex] and optionally ignoring the case.
|
static boolean |
isBlank(CharSequence thiz)
Returns `true` if this char sequence is empty or contains only whitespace characters.
|
static boolean |
isEmpty(CharSequence thiz)
Returns `true` if this char sequence is empty (contains no characters).
|
static boolean |
isNotEmpty(CharSequence thiz)
Returns `true` if this char sequence is not empty.
|
static boolean |
isNullOrBlank(CharSequence thiz)
Returns `true` if this nullable char sequence is either `null` or empty or consists solely of whitespace characters.
|
static boolean |
isNullOrEmpty(CharSequence thiz)
Returns `true` if this nullable char sequence is either `null` or empty.
|
static char |
last(CharSequence thiz) |
static int |
lastIndex(CharSequence thiz)
Returns the index of the last character in the char sequence or -1 if it is empty.
|
static int |
lastIndexOf(CharSequence thiz,
int ch) |
static int |
lastIndexOf(CharSequence thiz,
int ch,
boolean ignoreCase) |
static int |
lastIndexOf(CharSequence thiz,
int ch,
int startIndex) |
static int |
lastIndexOf(CharSequence thiz,
int ch,
int startIndex,
boolean ignoreCase)
Returns the index within this char sequence of the last occurrence of the specified character,
starting from the specified [startIndex].
|
static int |
lastIndexOf(CharSequence thiz,
String string) |
static int |
lastIndexOf(CharSequence thiz,
String string,
boolean ignoreCase) |
static int |
lastIndexOf(CharSequence thiz,
String string,
int startIndex) |
static int |
lastIndexOf(CharSequence thiz,
String string,
int startIndex,
boolean ignoreCase)
Returns the index within this char sequence of the last occurrence of the specified [string],
starting from the specified [startIndex].
|
static int |
lastIndexOfAny(CharSequence thiz,
char[] chars) |
static int |
lastIndexOfAny(CharSequence thiz,
char[] chars,
int startIndex) |
static int |
lastIndexOfAny(CharSequence thiz,
char[] chars,
int startIndex,
boolean ignoreCase)
Finds the index of the last occurrence of any of the specified [chars] in this char sequence,
starting from the specified [startIndex] and optionally ignoring the case.
|
static int |
lastIndexOfAny(CharSequence thiz,
Collection<String> strings) |
static int |
lastIndexOfAny(CharSequence thiz,
Collection<String> strings,
int startIndex) |
static int |
lastIndexOfAny(CharSequence thiz,
Collection<String> strings,
int startIndex,
boolean ignoreCase)
Finds the index of the last occurrence of any of the specified [strings] in this char sequence,
starting from the specified [startIndex] and optionally ignoring the case.
|
static CharSequence |
padEnd(CharSequence thiz,
int length,
char padChar)
Returns a char sequence with content of this char sequence padded at the end
to the specified [length] with the specified character or space.
|
static CharSequence |
padStart(CharSequence thiz,
int length,
char padChar)
Returns a char sequence with content of this char sequence padded at the beginning
to the specified [length] with the specified character or space.
|
static CharSequence |
removePrefix(CharSequence thiz,
CharSequence prefix)
If this char sequence starts with the given [prefix], returns a new char sequence
with the prefix removed.
|
static CharSequence |
removeSuffix(CharSequence thiz,
CharSequence suffix)
If this char sequence ends with the given [suffix], returns a new char sequence
with the suffix removed.
|
static boolean |
startsWith(CharSequence thiz,
char c)
Returns `true` if this char sequence starts with the specified character.
|
static boolean |
startsWith(CharSequence thiz,
CharSequence prefix)
Returns `true` if this char sequence starts with the specified prefix.
|
static boolean |
startsWithIgnoreCase(CharSequence thiz,
char c) |
static boolean |
startsWithIgnoreCase(CharSequence thiz,
CharSequence prefix)
Returns `true` if this char sequence starts with the specified prefix.
|
static String |
substring(CharSequence thiz,
int startIndex) |
static String |
substring(CharSequence thiz,
int startIndex,
int endIndex)
Returns a substring of chars from a range of this char sequence starting at the [startIndex] and ending right before the [endIndex].
|
static CharSequence |
trim(CharSequence thiz,
char... chars)
Returns a sub sequence of this char sequence having leading and trailing characters from the [chars] array trimmed.
|
static CharSequence |
trim(CharSequence thiz,
CharPredicate predicate)
Returns a sub sequence of this char sequence having leading and trailing characters matching the [predicate] trimmed.
|
static CharSequence |
trimEnd(CharSequence thiz)
Returns a sub sequence of this char sequence having trailing whitespace removed.
|
static CharSequence |
trimEnd(CharSequence thiz,
char... chars)
Returns a sub sequence of this char sequence having trailing characters from the [chars] array trimmed.
|
static CharSequence |
trimEnd(CharSequence thiz,
CharPredicate predicate)
Returns a sub sequence of this char sequence having trailing characters matching the [predicate] trimmed.
|
static CharSequence |
trimStart(CharSequence thiz)
Returns a sub sequence of this char sequence having leading whitespace removed.
|
static CharSequence |
trimStart(CharSequence thiz,
char... chars)
Returns a sub sequence of this char sequence having leading and trailing characters from the [chars] array trimmed.
|
static CharSequence |
trimStart(CharSequence thiz,
CharPredicate predicate)
Returns a sub sequence of this char sequence having leading characters matching the [predicate] trimmed.
|
public static CharSequence trim(CharSequence thiz, CharPredicate predicate)
public static CharSequence trimStart(CharSequence thiz, CharPredicate predicate)
public static CharSequence trimEnd(CharSequence thiz, CharPredicate predicate)
public static CharSequence trim(CharSequence thiz, char... chars)
public static CharSequence trimStart(CharSequence thiz, char... chars)
public static CharSequence trimEnd(CharSequence thiz, char... chars)
public static CharSequence trimStart(CharSequence thiz)
public static CharSequence trimEnd(CharSequence thiz)
public static CharSequence padStart(CharSequence thiz, int length, char padChar)
length - the desired string length.padChar - the character to pad string with, if it has length less than the [length] specified.public static CharSequence padEnd(CharSequence thiz, int length, char padChar)
length - the desired string length.padChar - the character to pad string with, if it has length less than the [length] specified.public static boolean isNullOrEmpty(CharSequence thiz)
public static boolean isEmpty(CharSequence thiz)
public static boolean isNotEmpty(CharSequence thiz)
public static boolean isBlank(CharSequence thiz)
public static boolean all(CharSequence thiz, CharPredicate predicate)
public static boolean isNullOrBlank(CharSequence thiz)
public static int lastIndex(CharSequence thiz)
public static String substring(CharSequence thiz, int startIndex, int endIndex)
startIndex - the start index (inclusive).endIndex - the end index (exclusive). If not specified, the length of the char sequence is used.public static String substring(CharSequence thiz, int startIndex)
public static CharSequence removePrefix(CharSequence thiz, CharSequence prefix)
public static CharSequence removeSuffix(CharSequence thiz, CharSequence suffix)
public static char first(CharSequence thiz)
public static char last(CharSequence thiz)
public static boolean startsWith(CharSequence thiz, char c)
public static boolean startsWithIgnoreCase(CharSequence thiz, char c)
public static boolean endsWith(CharSequence thiz, char c)
public static boolean endsWithIgnoreCase(CharSequence thiz, char c)
public static boolean startsWith(CharSequence thiz, CharSequence prefix)
public static boolean startsWithIgnoreCase(CharSequence thiz, CharSequence prefix)
public static boolean endsWith(CharSequence thiz, CharSequence suffix)
public static boolean endsWithIgnoreCase(CharSequence thiz, CharSequence suffix)
public static int indexOfAny(CharSequence thiz, char[] chars)
public static int indexOfAny(CharSequence thiz, char[] chars, int startIndex)
public static int indexOfAny(CharSequence thiz, char[] chars, int startIndex, boolean ignoreCase)
ignoreCase - `true` to ignore character case when matching a character.public static int lastIndexOfAny(CharSequence thiz, char[] chars)
public static int lastIndexOfAny(CharSequence thiz, char[] chars, int startIndex)
public static int lastIndexOfAny(CharSequence thiz, char[] chars, int startIndex, boolean ignoreCase)
startIndex - The index of character to start searching at. The search proceeds backward toward the beginning of the string.ignoreCase - `true` to ignore character case when matching a character.public static Pair<Integer,String> findAnyOf(CharSequence thiz, Collection<String> strings)
public static Pair<Integer,String> findAnyOf(CharSequence thiz, Collection<String> strings, int startIndex)
public static Pair<Integer,String> findAnyOf(CharSequence thiz, Collection<String> strings, int startIndex, boolean ignoreCase)
ignoreCase - `true` to ignore character case when matching a string.public static Pair<Integer,String> findLastAnyOf(CharSequence thiz, Collection<String> strings)
public static Pair<Integer,String> findLastAnyOf(CharSequence thiz, Collection<String> strings, int startIndex)
public static Pair<Integer,String> findLastAnyOf(CharSequence thiz, Collection<String> strings, int startIndex, boolean ignoreCase)
startIndex - The index of character to start searching at. The search proceeds backward toward the beginning of the string.ignoreCase - `true` to ignore character case when matching a string.public static int indexOfAny(CharSequence thiz, Collection<String> strings)
public static int indexOfAny(CharSequence thiz, Collection<String> strings, int startIndex)
public static int indexOfAny(CharSequence thiz, Collection<String> strings, int startIndex, boolean ignoreCase)
ignoreCase - `true` to ignore character case when matching a string.public static int lastIndexOfAny(CharSequence thiz, Collection<String> strings)
public static int lastIndexOfAny(CharSequence thiz, Collection<String> strings, int startIndex)
public static int lastIndexOfAny(CharSequence thiz, Collection<String> strings, int startIndex, boolean ignoreCase)
startIndex - The index of character to start searching at. The search proceeds backward toward the beginning of the string.ignoreCase - `true` to ignore character case when matching a string.public static int indexOf(CharSequence thiz, int ch)
public static int indexOf(CharSequence thiz, int ch, boolean ignoreCase)
public static int indexOf(CharSequence thiz, int ch, int startIndex)
public static int indexOf(CharSequence thiz, int ch, int startIndex, boolean ignoreCase)
ignoreCase - `true` to ignore character case when matching a character.public static int indexOf(CharSequence thiz, String string)
public static int indexOf(CharSequence thiz, String string, boolean ignoreCase)
public static int indexOf(CharSequence thiz, String string, int startIndex)
public static int indexOf(CharSequence thiz, String string, int startIndex, boolean ignoreCase)
ignoreCase - `true` to ignore character case when matching a string.public static int lastIndexOf(CharSequence thiz, int ch)
public static int lastIndexOf(CharSequence thiz, int ch, boolean ignoreCase)
public static int lastIndexOf(CharSequence thiz, int ch, int startIndex)
public static int lastIndexOf(CharSequence thiz, int ch, int startIndex, boolean ignoreCase)
startIndex - The index of character to start searching at. The search proceeds backward toward the beginning of the string.ignoreCase - `true` to ignore character case when matching a character.public static int lastIndexOf(CharSequence thiz, String string)
public static int lastIndexOf(CharSequence thiz, String string, boolean ignoreCase)
public static int lastIndexOf(CharSequence thiz, String string, int startIndex)
public static int lastIndexOf(CharSequence thiz, String string, int startIndex, boolean ignoreCase)
startIndex - The index of character to start searching at. The search proceeds backward toward the beginning of the string.ignoreCase - `true` to ignore character case when matching a string.public static boolean contains(CharSequence thiz, CharSequence other)
public static boolean contains(CharSequence thiz, CharSequence other, boolean ignoreCase)
ignoreCase - `true` to ignore character case when comparing strings.public static boolean contains(CharSequence thiz, char ch)
public static boolean contains(CharSequence thiz, char ch, boolean ignoreCase)
ignoreCase - `true` to ignore character case when comparing characters.Copyright © 2017. All rights reserved.