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 manifold.rt.api.util.Pair<Integer,String> |
findAnyOf(CharSequence thiz,
Collection<String> strings) |
static manifold.rt.api.util.Pair<Integer,String> |
findAnyOf(CharSequence thiz,
Collection<String> strings,
int startIndex) |
static manifold.rt.api.util.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 manifold.rt.api.util.Pair<Integer,String> |
findLastAnyOf(CharSequence thiz,
Collection<String> strings) |
static manifold.rt.api.util.Pair<Integer,String> |
findLastAnyOf(CharSequence thiz,
Collection<String> strings,
int startIndex) |
static manifold.rt.api.util.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 char |
get(CharSequence thiz,
int index)
Implement the index operator to enable indexed access to characters such as
text[i] . |
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)
predicate
trimmed.public static CharSequence trimStart(CharSequence thiz, CharPredicate predicate)
predicate
trimmed.public static CharSequence trimEnd(CharSequence thiz, CharPredicate predicate)
predicate
trimmed.public static CharSequence trim(CharSequence thiz, char... chars)
chars
array trimmed.public static CharSequence trimStart(CharSequence thiz, char... chars)
chars
array trimmed.public static CharSequence trimEnd(CharSequence thiz, char... chars)
chars
array trimmed.public static CharSequence trimStart(CharSequence thiz)
public static CharSequence trimEnd(CharSequence thiz)
public static CharSequence padStart(CharSequence thiz, int length, char padChar)
length
with the specified character or space.length
- the desired string length.padChar
- the character to pad string with, if it has length less than the length
specified.length
, consisting of string prepended with padChar
as many times.
as are necessary to reach that length.public static CharSequence padEnd(CharSequence thiz, int length, char padChar)
length
with the specified character or space.length
- the desired string length.padChar
- the character to pad string with, if it has length less than the length
specified.length
, consisting of string prepended with padChar
as many times.
as are necessary to reach that length.public static boolean isNullOrEmpty(CharSequence thiz)
true
if this nullable char sequence is either null
or empty.public static boolean isEmpty(CharSequence thiz)
true
if this char sequence is empty (contains no characters).public static boolean isNotEmpty(CharSequence thiz)
true
if this char sequence is not empty.public static boolean isBlank(CharSequence thiz)
true
if this char sequence is empty or contains only whitespace characters.public static boolean all(CharSequence thiz, CharPredicate predicate)
public static boolean isNullOrBlank(CharSequence thiz)
true
if this nullable char sequence is either null
or empty or consists solely of whitespace characters.public static int lastIndex(CharSequence thiz)
public static String substring(CharSequence thiz, int startIndex, int endIndex)
startIndex
and ending right before the 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)
prefix
, returns a new char sequence
with the prefix removed. Otherwise, returns a new char sequence with the same characters.public static CharSequence removeSuffix(CharSequence thiz, CharSequence suffix)
suffix
, returns a new char sequence
with the suffix removed. Otherwise, returns a new char sequence with the same characters.public static char first(CharSequence thiz)
public static char last(CharSequence thiz)
public static boolean startsWith(CharSequence thiz, char c)
true
if this char sequence starts with the specified character.public static boolean startsWithIgnoreCase(CharSequence thiz, char c)
public static boolean endsWith(CharSequence thiz, char c)
true
if this char sequence ends with the specified character.public static boolean endsWithIgnoreCase(CharSequence thiz, char c)
public static boolean startsWith(CharSequence thiz, CharSequence prefix)
true
if this char sequence starts with the specified prefix.public static boolean startsWithIgnoreCase(CharSequence thiz, CharSequence prefix)
true
if this char sequence starts with the specified prefix.public static boolean endsWith(CharSequence thiz, CharSequence suffix)
true
if this char sequence ends with the specified suffix.public static boolean endsWithIgnoreCase(CharSequence thiz, CharSequence suffix)
true
if this char sequence ends with the specified prefix.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)
chars
in this char sequence,
starting from the specified startIndex
and optionally ignoring the case.ignoreCase
- true
to ignore character case when matching a character.chars
or -1 if none of chars
are found.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)
chars
in this char sequence,
starting from the specified startIndex
and optionally ignoring the case.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.chars
or -1 if none of chars
are found.public static manifold.rt.api.util.Pair<Integer,String> findAnyOf(CharSequence thiz, Collection<String> strings)
public static manifold.rt.api.util.Pair<Integer,String> findAnyOf(CharSequence thiz, Collection<String> strings, int startIndex)
public static manifold.rt.api.util.Pair<Integer,String> findAnyOf(CharSequence thiz, Collection<String> strings, int startIndex, boolean ignoreCase)
strings
in this char sequence,
starting from the specified startIndex
and optionally ignoring the case.ignoreCase
- true
to ignore character case when matching a string.strings
and the string matched
or null
if none of strings
are found.
To avoid ambiguous results when strings in strings
have characters in common, this method proceeds from
the beginning to the end of this string, and finds at each position the first element in strings
that matches this string at that position.
public static manifold.rt.api.util.Pair<Integer,String> findLastAnyOf(CharSequence thiz, Collection<String> strings)
public static manifold.rt.api.util.Pair<Integer,String> findLastAnyOf(CharSequence thiz, Collection<String> strings, int startIndex)
public static manifold.rt.api.util.Pair<Integer,String> findLastAnyOf(CharSequence thiz, Collection<String> strings, int startIndex, boolean ignoreCase)
strings
in this char sequence,
starting from the specified startIndex
and optionally ignoring the case.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.strings
and the string matched or null
if none of strings
are found.
To avoid ambiguous results when strings in strings
have characters in common, this method proceeds from
the end toward the beginning of this string, and finds at each position the first element in strings
that matches this string at that position.
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)
strings
in this char sequence,
starting from the specified startIndex
and optionally ignoring the case.ignoreCase
- true
to ignore character case when matching a string.strings
or -1 if none of strings
are found.
To avoid ambiguous results when strings in strings
have characters in common, this method proceeds from
the beginning to the end of this string, and finds at each position the first element in strings
that matches this string at that position.
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)
strings
in this char sequence,
starting from the specified startIndex
and optionally ignoring the case.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.strings
or -1 if none of strings
are found.
To avoid ambiguous results when strings in strings
have characters in common, this method proceeds from
the end toward the beginning of this string, and finds at each position the first element in strings
that matches this string at that position.
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)
startIndex
.ignoreCase
- true
to ignore character case when matching a character.char
or -1 if none is found.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)
string
,
starting from the specified startIndex
.ignoreCase
- true
to ignore character case when matching a string.string
or `-1` if none is found.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
.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.char
or -1 if none is found.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)
string
,
starting from the specified startIndex
.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.string
or -1 if none is found.public static boolean contains(CharSequence thiz, CharSequence other)
public static boolean contains(CharSequence thiz, CharSequence other, boolean ignoreCase)
true
if this char sequence contains the specified other
sequence of characters as a substring.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)
true
if this char sequence contains the specified character char
.ignoreCase
- true
to ignore character case when comparing characters.public static char get(CharSequence thiz, int index)
text[i]
.index
- the index of the char
value.char
value at the specified index of this string.
The first char
value is at index 0
.IndexOutOfBoundsException
- if the index
argument is negative or not less than the length of this
string.Copyright © 2024. All rights reserved.