public interface RichCharSequence<T extends RichCharSequence> extends CharSequence, Comparable<CharSequence>
| Modifier and Type | Field and Description |
|---|---|
static String |
EOL |
static char |
EOL_CHAR |
static char |
EOL_CHAR1 |
static char |
EOL_CHAR2 |
static String |
EOL_CHARS |
static String |
SPACE |
static int |
SPLIT_INCLUDE_DELIM_PARTS |
static int |
SPLIT_INCLUDE_DELIMS |
static int |
SPLIT_SKIP_EMPTY |
static int |
SPLIT_TRIM_PARTS |
static int |
SPLIT_TRIM_SKIP_EMPTY |
static String |
WHITESPACE_CHARS |
static String |
WHITESPACE_NBSP_CHARS |
static String |
WHITESPACE_NO_EOL_CHARS |
| Modifier and Type | Method and Description |
|---|---|
T |
append(CharSequence... others) |
T |
appendTo(StringBuilder out) |
T |
appendTo(StringBuilder out,
int start) |
T |
appendTo(StringBuilder out,
int start,
int end) |
int |
countLeading() |
int |
countLeading(char c) |
int |
countLeading(char c,
int startIndex) |
int |
countLeading(char c,
int startIndex,
int endIndex) |
int |
countLeading(CharSequence chars)
Count leading/trailing characters of this sequence
|
int |
countLeading(CharSequence chars,
int startIndex) |
int |
countLeading(CharSequence chars,
int startIndex,
int endIndex) |
int |
countLeadingColumns(int startColumn,
CharSequence chars) |
int |
countLeadingNot() |
int |
countLeadingNot(char c) |
int |
countLeadingNot(char c,
int startIndex) |
int |
countLeadingNot(char c,
int startIndex,
int endIndex) |
int |
countLeadingNot(CharSequence chars) |
int |
countLeadingNot(CharSequence chars,
int startIndex) |
int |
countLeadingNot(CharSequence chars,
int startIndex,
int endIndex) |
int |
countOf() |
int |
countOf(char c) |
int |
countOf(char c,
int startIndex) |
int |
countOf(char c,
int startIndex,
int endIndex) |
int |
countOfAny(CharSequence chars) |
int |
countOfAny(CharSequence chars,
int startIndex) |
int |
countOfAny(CharSequence chars,
int startIndex,
int endIndex) |
int |
countOfAnyNot(CharSequence chars) |
int |
countOfAnyNot(CharSequence chars,
int startIndex) |
int |
countOfAnyNot(CharSequence chars,
int startIndex,
int endIndex) |
int |
countOfNot() |
int |
countOfNot(char c) |
int |
countOfNot(char c,
int startIndex) |
int |
countOfNot(char c,
int startIndex,
int endIndex) |
int |
countTrailing() |
int |
countTrailing(char c) |
int |
countTrailing(char c,
int startIndex) |
int |
countTrailing(char c,
int startIndex,
int endIndex) |
int |
countTrailing(CharSequence chars) |
int |
countTrailing(CharSequence chars,
int startIndex) |
int |
countTrailing(CharSequence chars,
int startIndex,
int endIndex) |
int |
countTrailingNot() |
int |
countTrailingNot(char c) |
int |
countTrailingNot(char c,
int startIndex) |
int |
countTrailingNot(char c,
int startIndex,
int endIndex) |
int |
countTrailingNot(CharSequence chars) |
int |
countTrailingNot(CharSequence chars,
int startIndex) |
int |
countTrailingNot(CharSequence chars,
int startIndex,
int endIndex) |
T[] |
emptyArray() |
char |
endCharAt(int index)
Convenience method to get characters offset from end of sequence.
|
int |
endOfDelimitedBy(CharSequence s,
int index)
Find start/end region in this sequence delimited by any characters in argument or the CharSequence
|
int |
endOfDelimitedByAny(CharSequence s,
int index) |
int |
endOfDelimitedByAnyNot(CharSequence s,
int index) |
int |
endOfLine(int index)
Get the offset of the end of line at given index, end of line delimited by \n or any of \n \r \r\n for Any methods.
|
int |
endOfLineAnyEOL(int index) |
T |
endSequence(int start)
Convenience method to get characters offset from end of sequence.
|
T |
endSequence(int start,
int end)
Convenience method to get characters offset from end of sequence.
|
boolean |
endsWith(CharSequence suffix)
test if this sequence ends with given characters
|
boolean |
endsWith(CharSequence suffix,
boolean ignoreCase)
test if this sequence ends with given characters
|
boolean |
endsWithIgnoreCase(CharSequence suffix)
test if this sequence ends with given characters, ignoring case differences
|
int |
eolLength()
Get the length of EOL character at the end of this sequence, if present.
|
int |
eolLength(int eolStart)
Get the length of EOL character at the given index of this sequence, if present.
|
boolean |
equals(Object other,
boolean ignoreCase)
Test the sequence for a match to another CharSequence
|
boolean |
equalsIgnoreCase(CharSequence other)
Test the sequence for a match to another CharSequence, ignoring case differences
|
char |
firstChar() |
int |
getColumnAtIndex(int index) |
Pair<Integer,Integer> |
getLineColumnAtIndex(int index)
Get the line and column information from index into sequence
|
T |
ifNull(T other)
If this sequence is the BasedSequence.NULL instance then returns other,
otherwise returns this sequence.
|
T |
ifNullEmptyAfter(T other)
If this sequence is the BasedSequence.NULL instance then returns an empty subSequence from the end of other,
otherwise returns this sequence.
|
T |
ifNullEmptyBefore(T other)
If this sequence is the BasedSequence.NULL instance then returns an empty subSequence from the start of other,
otherwise returns this sequence.
|
int |
indexOf(char c) |
int |
indexOf(char c,
int fromIndex) |
int |
indexOf(char c,
int fromIndex,
int endIndex) |
int |
indexOf(CharSequence s)
All index methods return the position or -1 if not found of the given character, characters or string.
|
int |
indexOf(CharSequence s,
int fromIndex) |
int |
indexOf(CharSequence s,
int fromIndex,
int endIndex) |
int[] |
indexOfAll(CharSequence s)
Get indices of all occurrences of a sequence
|
int |
indexOfAny(char c1,
char c2) |
int |
indexOfAny(char c1,
char c2,
char c3) |
int |
indexOfAny(char c1,
char c2,
char c3,
int fromIndex) |
int |
indexOfAny(char c1,
char c2,
char c3,
int fromIndex,
int endIndex) |
int |
indexOfAny(char c1,
char c2,
int fromIndex) |
int |
indexOfAny(char c1,
char c2,
int fromIndex,
int endIndex) |
int |
indexOfAny(CharSequence s) |
int |
indexOfAny(CharSequence s,
int fromIndex) |
int |
indexOfAny(CharSequence s,
int fromIndex,
int endIndex) |
int |
indexOfAnyNot(char c1,
char c2) |
int |
indexOfAnyNot(char c1,
char c2,
char c3) |
int |
indexOfAnyNot(char c1,
char c2,
char c3,
int fromIndex) |
int |
indexOfAnyNot(char c1,
char c2,
char c3,
int fromIndex,
int endIndex) |
int |
indexOfAnyNot(char c1,
char c2,
int fromIndex) |
int |
indexOfAnyNot(char c1,
char c2,
int fromIndex,
int endIndex) |
int |
indexOfAnyNot(CharSequence s) |
int |
indexOfAnyNot(CharSequence s,
int fromIndex) |
int |
indexOfAnyNot(CharSequence s,
int fromIndex,
int endIndex) |
int |
indexOfNot(char c) |
int |
indexOfNot(char c,
int fromIndex) |
int |
indexOfNot(char c,
int fromIndex,
int endIndex) |
boolean |
isBlank() |
boolean |
isEmpty() |
boolean |
isNotNull() |
boolean |
isNull() |
char |
lastChar() |
int |
lastIndexOf(char c) |
int |
lastIndexOf(char c,
int fromIndex) |
int |
lastIndexOf(char c,
int startIndex,
int fromIndex) |
int |
lastIndexOf(CharSequence s) |
int |
lastIndexOf(CharSequence s,
int fromIndex) |
int |
lastIndexOf(CharSequence s,
int startIndex,
int fromIndex) |
int |
lastIndexOfAny(char c1,
char c2) |
int |
lastIndexOfAny(char c1,
char c2,
char c3) |
int |
lastIndexOfAny(char c1,
char c2,
char c3,
int fromIndex) |
int |
lastIndexOfAny(char c1,
char c2,
char c3,
int startIndex,
int fromIndex) |
int |
lastIndexOfAny(char c1,
char c2,
int fromIndex) |
int |
lastIndexOfAny(char c1,
char c2,
int startIndex,
int fromIndex) |
int |
lastIndexOfAny(CharSequence s) |
int |
lastIndexOfAny(CharSequence s,
int fromIndex) |
int |
lastIndexOfAny(CharSequence s,
int startIndex,
int fromIndex) |
int |
lastIndexOfAnyNot(char c1,
char c2) |
int |
lastIndexOfAnyNot(char c1,
char c2,
char c3) |
int |
lastIndexOfAnyNot(char c1,
char c2,
char c3,
int fromIndex) |
int |
lastIndexOfAnyNot(char c1,
char c2,
char c3,
int startIndex,
int fromIndex) |
int |
lastIndexOfAnyNot(char c1,
char c2,
int fromIndex) |
int |
lastIndexOfAnyNot(char c1,
char c2,
int startIndex,
int fromIndex) |
int |
lastIndexOfAnyNot(CharSequence s) |
int |
lastIndexOfAnyNot(CharSequence s,
int fromIndex) |
int |
lastIndexOfAnyNot(CharSequence s,
int startIndex,
int fromIndex) |
int |
lastIndexOfNot(char c) |
int |
lastIndexOfNot(char c,
int fromIndex) |
int |
lastIndexOfNot(char c,
int startIndex,
int fromIndex) |
T |
lineAt(int index)
Get the line characters at given index, line delimited by \n
|
T |
lineAtAnyEOL(int index)
Get the line characters at given index, line delimited by \n, \r or \r\n
|
boolean |
matchChars(CharSequence chars)
Test the sequence portion for a match to another CharSequence
|
boolean |
matchChars(CharSequence chars,
boolean ignoreCase)
Test the sequence portion for a match to another CharSequence
|
boolean |
matchChars(CharSequence chars,
int startIndex)
Test the sequence portion for a match to another CharSequence
|
boolean |
matchChars(CharSequence chars,
int startIndex,
boolean ignoreCase)
Test the sequence portion for a match to another CharSequence
|
boolean |
matchCharsIgnoreCase(CharSequence chars)
Test the sequence portion for a match to another CharSequence, ignoring case differences
|
boolean |
matchCharsIgnoreCase(CharSequence chars,
int startIndex)
Test the sequence portion for a match to another CharSequence, ignoring case differences
|
boolean |
matchCharsReversed(CharSequence chars,
int endIndex)
Test the sequence portion for a match to another CharSequence, reverse order
|
boolean |
matchCharsReversed(CharSequence chars,
int endIndex,
boolean ignoreCase)
Test the sequence portion for a match to another CharSequence, reverse order
|
boolean |
matchCharsReversedIgnoreCase(CharSequence chars,
int endIndex)
Test the sequence portion for a match to another CharSequence, reverse order, ignoring case differences
|
boolean |
matches(CharSequence chars)
Test the sequence for a match to another CharSequence
|
boolean |
matches(CharSequence chars,
boolean ignoreCase)
Test the sequence for a match to another CharSequence
|
boolean |
matchesIgnoreCase(CharSequence chars)
Test the sequence for a match to another CharSequence, ignoring case differences
|
char |
midCharAt(int index)
Convenience method to get characters offset from start or end of sequence.
|
T |
midSequence(int start)
Convenience method to get characters offset from start or end of sequence.
|
T |
midSequence(int start,
int end)
Convenience method to get characters offset from start or end of sequence.
|
String |
normalizeEndWithEOL()
replace any \r\n and \r by \n, append terminating EOL if one is not present
|
String |
normalizeEOL()
replace any \r\n and \r by \n
|
T |
nullIf(boolean condition)
If condition is true return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIf(CharSequence... matches)
If this sequence matches one of given sequences return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIfBlank()
If this sequence is blank return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIfEmpty()
If this sequence is empty return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIfEndsWith(CharSequence... matches)
If this sequence ends with one of given sequences return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIfEndsWithNot(CharSequence... matches)
If this sequence does not end with one of given sequences return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIfNot(CharSequence... matches)
If this sequence does not match one of given sequences return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIfStartsWith(CharSequence... matches)
If this sequence starts with one of given sequences return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullIfStartsWithNot(CharSequence... matches)
If this sequence does not start with one of given sequences return BasedSequence.NULL otherwise returns this sequence.
|
T |
nullSequence() |
T |
padEnd(int length) |
T |
padEnd(int length,
char pad) |
T |
padStart(int length) |
T |
padStart(int length,
char pad) |
T |
removePrefix(CharSequence prefix)
Remove prefix if present
|
T |
removePrefix(CharSequence prefix,
boolean ignoreCase)
Remove prefix if present
|
T |
removePrefixIgnoreCase(CharSequence prefix)
Remove prefix if present, ignoring case differences
|
T |
removeProperPrefix(CharSequence prefix)
Remove prefix if present but only if this sequence is longer than the suffix
|
T |
removeProperPrefix(CharSequence prefix,
boolean ignoreCase)
Remove prefix if present but only if this sequence is longer than the suffix
|
T |
removeProperPrefixIgnoreCase(CharSequence prefix)
Remove prefix if present but only if this sequence is longer than the suffix, ignoring case differences
|
T |
removeProperSuffix(CharSequence suffix)
Remove suffix if present but only if this sequence is longer than the suffix
|
T |
removeProperSuffix(CharSequence suffix,
boolean ignoreCase)
Remove suffix if present but only if this sequence is longer than the suffix
|
T |
removeProperSuffixIgnoreCase(CharSequence suffix)
Remove suffix if present but only if this sequence is longer than the suffix, ignoring case differences
|
T |
removeSuffix(CharSequence suffix)
Remove suffix if present
|
T |
removeSuffix(CharSequence suffix,
boolean ignoreCase)
Remove suffix if present
|
T |
removeSuffixIgnoreCase(CharSequence suffix)
Remove suffix if present, ignoring case differences
|
T |
replace(CharSequence find,
CharSequence replace)
Replace all occurrences of one sequence with another
|
T |
sequenceOf(CharSequence charSequence)
Factory function
|
T |
sequenceOf(CharSequence charSequence,
int startIndex)
Factory function
|
T |
sequenceOf(CharSequence charSequence,
int startIndex,
int endIndex)
Factory function
|
T[] |
split(char delimiter) |
T[] |
split(char delimiter,
int limit) |
T[] |
split(char delimiter,
int limit,
int flags) |
T[] |
split(char delimiter,
int limit,
int flags,
String trimChars)
Split helpers based on delimiter character sets contained in CharSequence
|
T[] |
split(CharSequence delimiter) |
T[] |
split(CharSequence delimiter,
int limit) |
T[] |
split(CharSequence delimiter,
int limit,
int flags) |
T[] |
split(CharSequence delimiter,
int limit,
int flags,
String trimChars) |
int |
startOfDelimitedBy(CharSequence s,
int index) |
int |
startOfDelimitedByAny(CharSequence s,
int index) |
int |
startOfDelimitedByAnyNot(CharSequence s,
int index) |
int |
startOfLine(int index) |
int |
startOfLineAnyEOL(int index) |
boolean |
startsWith(CharSequence prefix)
test if this sequence starts with given characters
|
boolean |
startsWith(CharSequence prefix,
boolean ignoreCase)
test if this sequence starts with given characters
|
boolean |
startsWithIgnoreCase(CharSequence prefix)
test if this sequence starts with given characters, ignoring case differences
|
T |
subSequence(int start)
Get a portion of this sequence starting from a given offset to end of the sequence
|
T |
subSequence(int start,
int end)
Get a portion of this sequence
|
T |
subSequence(Range range)
Get a portion of this sequence
|
T |
toLowerCase()
Map characters of this sequence to: Uppercase, Lowercase or use custom mapping
|
T |
toLowerCase(Locale locale) |
T |
toMapped(CharMapper mapper) |
T |
toUpperCase() |
T |
toUpperCase(Locale locale) |
String |
toVisibleWhitespaceString() |
T |
trim() |
T |
trim(CharSequence chars) |
T |
trimEnd() |
T |
trimEnd(CharSequence chars) |
T |
trimEnd(int keepLength) |
T |
trimEnd(int keepLength,
CharSequence chars) |
T |
trimEOL() |
T |
trimLeadBlankLines() |
T |
trimmedEnd() |
T |
trimmedEnd(CharSequence chars) |
T |
trimmedEnd(int keepLength) |
T |
trimmedEnd(int keepLength,
CharSequence chars) |
T |
trimmedEOL() |
T |
trimmedStart() |
T |
trimmedStart(CharSequence chars) |
T |
trimmedStart(int keepLength) |
T |
trimmedStart(int keepLength,
CharSequence chars)
Get the characters Trimmed, Trimmed from start/end of this sequence, characters to trim are passed in the sequence argument
|
T |
trimStart() |
T |
trimStart(CharSequence chars) |
T |
trimStart(int keepLength) |
T |
trimStart(int keepLength,
CharSequence chars)
Trim, Trim start/end of this sequence, characters to trim are passed in the sequence argument
|
T |
trimTailBlankLines()
Trim leading trailing blank lines in this sequence
|
charAt, chars, codePoints, length, toStringcompareTostatic final String EOL
static final String SPACE
static final String WHITESPACE_NO_EOL_CHARS
static final String WHITESPACE_CHARS
static final String WHITESPACE_NBSP_CHARS
static final String EOL_CHARS
static final char EOL_CHAR
static final char EOL_CHAR1
static final char EOL_CHAR2
static final int SPLIT_INCLUDE_DELIMS
static final int SPLIT_TRIM_PARTS
static final int SPLIT_SKIP_EMPTY
static final int SPLIT_INCLUDE_DELIM_PARTS
static final int SPLIT_TRIM_SKIP_EMPTY
T[] emptyArray()
T nullSequence()
char lastChar()
char firstChar()
T subSequence(int start, int end)
subSequence in interface CharSequencestart - offset from start of this sequenceend - offset from start of this sequenceT subSequence(Range range)
range - range to get, coordinates offset form start of this sequenceT subSequence(int start)
start - offset from start of this sequenceT endSequence(int start, int end)
start - offset from end of sequence [ 0..length() )end - offset from end of sequence [ 0..length() )T endSequence(int start)
start - offset from end of sequence [ 0..length() )char endCharAt(int index)
index - offset from end of sequenceT midSequence(int start, int end)
no exceptions are thrown, instead a \0 is returned for an invalid index positions
start - offset into this sequenceend - offset into this sequenceT midSequence(int start)
no exceptions are thrown, instead a \0 is returned for an invalid index positions
start - offset into this sequencechar midCharAt(int index)
index - of character to getT sequenceOf(CharSequence charSequence)
charSequence - char sequence from which to construct a rich char sequenceT sequenceOf(CharSequence charSequence, int startIndex)
charSequence - char sequence from which to construct a rich char sequencestartIndex - start index of the sequence to useT sequenceOf(CharSequence charSequence, int startIndex, int endIndex)
charSequence - char sequence from which to construct a rich char sequencestartIndex - start index of the sequence to useendIndex - end index of the sequence to useint indexOf(CharSequence s)
The basic methods have overloads for 1, 2, or 3 characters and CharSequence parameters. If fromIndex is not given then for forward searching methods 0 is taken as the value, for reverse searching methods length() is taken as the value
For forward searching methods fromIndex is the minimum start position for search and endIndex is the maximum end position, if not given the length() of string is assumed.
For reverse searching methods fromIndex is the maximum start position for search and startIndex is the minimum end position, if not given then 0 is assumed.
Variations of arguments are for convenience and speed when 1, 2 or 3 characters are needed to be tested. Methods that take a character set in the form of CharSequence will route their call to character based methods if the CharSequence is only 1, 2 or 3 characters long.
indexOf(CharSequence): returns the index of the next occurrence of given text in this sequence
indexOfAny(CharSequence): returns the index of the next occurrence of any of the characters in this sequence indexOfAny(char): returns the index of the next occurrence of any of the characters in this sequence indexOfAny(char,char): returns the index of the next occurrence of any of the characters in this sequence indexOfAny(char,char,char): returns the index of the next occurrence of any of the characters in this sequence
indexOfAnyNot(CharSequence): returns the index of the next occurrence of any of the characters not in this sequence indexOfAnyNot(char): returns the index of the next occurrence of any of the characters not in this sequence indexOfAnyNot(char,char): returns the index of the next occurrence of any of the characters not in this sequence indexOfAnyNot(char,char,char): returns the index of the next occurrence of any of the characters not in this sequence
lastIndexOf(CharSequence): returns the index of the previous occurrence of given text in this sequence, reversed search
lastIndexOfAny(CharSequence): returns the index of the previous occurrence of any of the characters in this sequence, reversed search lastIndexOfAny(char): returns the index of the previous occurrence of any of the characters in this sequence, reversed search lastIndexOfAny(char,char): returns the index of the previous occurrence of any of the characters in this sequence, reversed search lastIndexOfAny(char,char,char): returns the index of the previous occurrence of any of the characters in this sequence, reversed search
lastIndexOfAnyNot(CharSequence): returns the index of the previous occurrence of any of the characters not in this sequence, reversed search lastIndexOfAnyNot(Char): returns the index of the previous occurrence of any of the characters not in this sequence, reversed search lastIndexOfAnyNot(char,char): returns the index of the previous occurrence of any of the characters not in this sequence, reversed search lastIndexOfAnyNot(char,char,char): returns the index of the previous occurrence of any of the characters not in this sequence, reversed search
s - character sequence whose occurrence to findint indexOf(CharSequence s, int fromIndex)
int indexOf(CharSequence s, int fromIndex, int endIndex)
int indexOf(char c)
int indexOfAny(char c1,
char c2)
int indexOfAny(char c1,
char c2,
char c3)
int indexOfAny(CharSequence s)
int indexOf(char c,
int fromIndex)
int indexOfAny(char c1,
char c2,
int fromIndex)
int indexOfAny(char c1,
char c2,
char c3,
int fromIndex)
int indexOfAny(CharSequence s, int fromIndex)
int indexOf(char c,
int fromIndex,
int endIndex)
int indexOfAny(char c1,
char c2,
int fromIndex,
int endIndex)
int indexOfAny(char c1,
char c2,
char c3,
int fromIndex,
int endIndex)
int indexOfAny(CharSequence s, int fromIndex, int endIndex)
int indexOfNot(char c)
int indexOfAnyNot(char c1,
char c2)
int indexOfAnyNot(char c1,
char c2,
char c3)
int indexOfAnyNot(CharSequence s)
int indexOfNot(char c,
int fromIndex)
int indexOfAnyNot(char c1,
char c2,
int fromIndex)
int indexOfAnyNot(char c1,
char c2,
char c3,
int fromIndex)
int indexOfAnyNot(CharSequence s, int fromIndex)
int indexOfNot(char c,
int fromIndex,
int endIndex)
int indexOfAnyNot(char c1,
char c2,
int fromIndex,
int endIndex)
int indexOfAnyNot(char c1,
char c2,
char c3,
int fromIndex,
int endIndex)
int indexOfAnyNot(CharSequence s, int fromIndex, int endIndex)
int lastIndexOf(CharSequence s)
int lastIndexOf(CharSequence s, int fromIndex)
int lastIndexOf(CharSequence s, int startIndex, int fromIndex)
int lastIndexOf(char c)
int lastIndexOfAny(char c1,
char c2)
int lastIndexOfAny(char c1,
char c2,
char c3)
int lastIndexOfAny(CharSequence s)
int lastIndexOf(char c,
int fromIndex)
int lastIndexOfAny(char c1,
char c2,
int fromIndex)
int lastIndexOfAny(char c1,
char c2,
char c3,
int fromIndex)
int lastIndexOfAny(CharSequence s, int fromIndex)
int lastIndexOf(char c,
int startIndex,
int fromIndex)
int lastIndexOfAny(char c1,
char c2,
int startIndex,
int fromIndex)
int lastIndexOfAny(char c1,
char c2,
char c3,
int startIndex,
int fromIndex)
int lastIndexOfAny(CharSequence s, int startIndex, int fromIndex)
int lastIndexOfNot(char c)
int lastIndexOfAnyNot(char c1,
char c2)
int lastIndexOfAnyNot(char c1,
char c2,
char c3)
int lastIndexOfAnyNot(CharSequence s)
int lastIndexOfNot(char c,
int fromIndex)
int lastIndexOfAnyNot(char c1,
char c2,
int fromIndex)
int lastIndexOfAnyNot(char c1,
char c2,
char c3,
int fromIndex)
int lastIndexOfAnyNot(CharSequence s, int fromIndex)
int lastIndexOfNot(char c,
int startIndex,
int fromIndex)
int lastIndexOfAnyNot(char c1,
char c2,
int startIndex,
int fromIndex)
int lastIndexOfAnyNot(char c1,
char c2,
char c3,
int startIndex,
int fromIndex)
int lastIndexOfAnyNot(CharSequence s, int startIndex, int fromIndex)
int countLeading(CharSequence chars)
Parameters can be: 1, 2 or 3 characters or CharSequence. For character arguments counts any contiguous leading/trailing characters in the sequence.
For CharSequence counts counts any contiguous leading/trailing characters in the sequence which are contained in the given char sequence.
All functions have overloads: with no fromIndex then 0 is taken for leading and length() for trailing methods with fromIndex then this is taken as the start for leading and end for trailing methods with fromIndex and endIndex, counting will start at fromIndex and stop at endIndex
countLeading(): count contiguous leading space/tab characters in this sequence countLeading(CharSequence): count contiguous leading characters from set in this sequence countLeading(char): count contiguous leading characters from set in this sequence countLeading(char,char): count contiguous leading characters from set in this sequence countLeading(char,char,char): count contiguous leading characters from set in this sequence
countLeadingNot(): count contiguous leading not space/tabs in this sequence countLeadingNot(CharSequence): count contiguous leading characters not from set in this sequence countLeadingNot(char): count contiguous leading characters not from set in this sequence countLeadingNot(char,char): count contiguous leading characters not from set in this sequence countLeadingNot(char,char,char): count contiguous leading characters not from set in this sequence
countTrailing(): count contiguous leading space/tab in this sequence countTrailing(CharSequence): count contiguous leading characters from set in this sequence countTrailing(char): count contiguous leading characters from set in this sequence countTrailing(char,char): count contiguous leading characters from set in this sequence countTrailing(char,char,char): count contiguous leading characters from set in this sequence
countTrailingNot(): count contiguous leading not space/tabs in this sequence countTrailingNot(CharSequence): count contiguous leading characters not from set in this sequence countTrailingNot(char): count contiguous leading characters not from set in this sequence countTrailingNot(char,char): count contiguous leading characters not from set in this sequence countTrailingNot(char,char,char): count contiguous leading characters not from set in this sequence
chars - set of contiguous characters which should be counted at start of sequenceint countLeadingNot(CharSequence chars)
int countLeading(CharSequence chars, int startIndex)
int countLeadingNot(CharSequence chars, int startIndex)
int countLeading(CharSequence chars, int startIndex, int endIndex)
int countLeadingNot(CharSequence chars, int startIndex, int endIndex)
int countTrailing(CharSequence chars)
int countTrailingNot(CharSequence chars)
int countTrailing(CharSequence chars, int startIndex)
int countTrailingNot(CharSequence chars, int startIndex)
int countTrailing(CharSequence chars, int startIndex, int endIndex)
int countTrailingNot(CharSequence chars, int startIndex, int endIndex)
int countLeading(char c)
int countLeadingNot(char c)
int countLeading(char c,
int startIndex)
int countLeadingNot(char c,
int startIndex)
int countLeading(char c,
int startIndex,
int endIndex)
int countLeadingNot(char c,
int startIndex,
int endIndex)
int countTrailing(char c)
int countTrailingNot(char c)
int countTrailing(char c,
int startIndex)
int countTrailingNot(char c,
int startIndex)
int countTrailing(char c,
int startIndex,
int endIndex)
int countTrailingNot(char c,
int startIndex,
int endIndex)
int countLeading()
int countLeadingNot()
int countTrailing()
int countTrailingNot()
int countOf()
int countOfNot()
int countOf(char c)
int countOfNot(char c)
int countOf(char c,
int startIndex)
int countOfNot(char c,
int startIndex)
int countOf(char c,
int startIndex,
int endIndex)
int countOfNot(char c,
int startIndex,
int endIndex)
int countOfAny(CharSequence chars)
int countOfAnyNot(CharSequence chars)
int countOfAny(CharSequence chars, int startIndex)
int countOfAnyNot(CharSequence chars, int startIndex)
int countOfAny(CharSequence chars, int startIndex, int endIndex)
int countOfAnyNot(CharSequence chars, int startIndex, int endIndex)
int countLeadingColumns(int startColumn,
CharSequence chars)
T trimStart(int keepLength, CharSequence chars)
returns trimmed sequence or if nothing matched the original sequence
If character set in the form of character sequence is not passed in the WHITESPACE_CHARS are assumed.
keepLength - minimum length of string to keepchars - set of characters to trim from start of lineT trimEnd(int keepLength, CharSequence chars)
T trimStart(int keepLength)
T trimEnd(int keepLength)
T trimStart(CharSequence chars)
T trimEnd(CharSequence chars)
T trim(CharSequence chars)
T trimStart()
T trimEnd()
T trim()
T trimEOL()
T padStart(int length, char pad)
T padEnd(int length, char pad)
T padStart(int length)
T padEnd(int length)
T trimmedStart(int keepLength, CharSequence chars)
returns trimmed sequence or if nothing matched the original sequence
keepLength - minimum length of string to keepchars - set of characters to trim from start of lineT trimmedEnd(int keepLength, CharSequence chars)
T trimmedStart(int keepLength)
T trimmedEnd(int keepLength)
T trimmedStart(CharSequence chars)
T trimmedEnd(CharSequence chars)
T trimmedStart()
T trimmedEnd()
T trimmedEOL()
int eolLength()
\n - 1 \r - 1 \r\n - 2
int eolLength(int eolStart)
\n - 1 \r - 1 \r\n - 2
boolean isEmpty()
boolean isBlank()
boolean isNull()
boolean isNotNull()
T ifNull(T other)
other - based sequence to return if this is BasedSequence.NULLT ifNullEmptyAfter(T other)
other - based sequence from which to take the empty sequenceT ifNullEmptyBefore(T other)
other - based sequence from which to take the empty sequenceT nullIfEmpty()
T nullIfBlank()
T nullIf(boolean condition)
condition - when true return NULL else thisT nullIf(CharSequence... matches)
matches - match sequence listT nullIfNot(CharSequence... matches)
matches - match sequence listT nullIfStartsWith(CharSequence... matches)
matches - match sequence listT nullIfStartsWithNot(CharSequence... matches)
matches - match sequence listT nullIfEndsWith(CharSequence... matches)
matches - match sequence listT nullIfEndsWithNot(CharSequence... matches)
matches - match sequence listint endOfDelimitedBy(CharSequence s, int index)
For Any and AnyNot methods uses the CharSequence argument as a character set of possible delimiting characters
s - character sequence delimiting the regionindex - from which to start looking for end of regionint endOfDelimitedByAny(CharSequence s, int index)
int endOfDelimitedByAnyNot(CharSequence s, int index)
int startOfDelimitedBy(CharSequence s, int index)
int startOfDelimitedByAny(CharSequence s, int index)
int startOfDelimitedByAnyNot(CharSequence s, int index)
int endOfLine(int index)
index - index where to start searching for end of lineint endOfLineAnyEOL(int index)
int startOfLine(int index)
int startOfLineAnyEOL(int index)
T lineAt(int index)
index - index at which to get the lineT lineAtAnyEOL(int index)
index - index at which to get the lineString normalizeEOL()
String normalizeEndWithEOL()
boolean matches(CharSequence chars)
chars - characters to match againstboolean matchesIgnoreCase(CharSequence chars)
chars - characters to match againstboolean equalsIgnoreCase(CharSequence other)
other - characters to match againstboolean matches(CharSequence chars, boolean ignoreCase)
chars - characters to match againstignoreCase - case ignored when trueboolean equals(Object other, boolean ignoreCase)
other - characters to match againstignoreCase - case ignored when trueboolean matchChars(CharSequence chars)
chars - characters to match againstboolean matchCharsIgnoreCase(CharSequence chars)
chars - characters to match againstboolean matchChars(CharSequence chars, boolean ignoreCase)
chars - characters to match againstignoreCase - case ignored when trueboolean matchChars(CharSequence chars, int startIndex)
chars - characters to match againststartIndex - index from which to start the matchboolean matchCharsIgnoreCase(CharSequence chars, int startIndex)
chars - characters to match againststartIndex - index from which to start the matchboolean matchChars(CharSequence chars, int startIndex, boolean ignoreCase)
chars - characters to match againststartIndex - index from which to start the matchignoreCase - case ignored when trueboolean matchCharsReversed(CharSequence chars, int endIndex)
chars - characters to match againstendIndex - index from which to start the match and proceed to 0boolean matchCharsReversedIgnoreCase(CharSequence chars, int endIndex)
chars - characters to match againstendIndex - index from which to start the match and proceed to 0boolean matchCharsReversed(CharSequence chars, int endIndex, boolean ignoreCase)
chars - characters to match againstendIndex - index from which to start the match and proceed to 0ignoreCase - case ignored when trueboolean endsWith(CharSequence suffix)
suffix - characters to testboolean endsWithIgnoreCase(CharSequence suffix)
suffix - characters to testboolean endsWith(CharSequence suffix, boolean ignoreCase)
suffix - characters to testignoreCase - case ignored when trueboolean startsWith(CharSequence prefix)
prefix - characters to testboolean startsWithIgnoreCase(CharSequence prefix)
prefix - characters to testboolean startsWith(CharSequence prefix, boolean ignoreCase)
prefix - characters to testignoreCase - case ignored when trueT removeSuffix(CharSequence suffix)
suffix - characters to removeT removeSuffixIgnoreCase(CharSequence suffix)
suffix - characters to removeT removeSuffix(CharSequence suffix, boolean ignoreCase)
suffix - characters to removeignoreCase - case ignored when trueT removePrefix(CharSequence prefix)
prefix - characters to removeT removePrefixIgnoreCase(CharSequence prefix)
prefix - characters to removeT removePrefix(CharSequence prefix, boolean ignoreCase)
prefix - characters to removeignoreCase - case ignored when trueT removeProperSuffix(CharSequence suffix)
suffix - characters to removeT removeProperSuffixIgnoreCase(CharSequence suffix)
suffix - characters to removeT removeProperSuffix(CharSequence suffix, boolean ignoreCase)
suffix - characters to removeignoreCase - case ignored when trueT removeProperPrefix(CharSequence prefix)
prefix - characters to removeT removeProperPrefixIgnoreCase(CharSequence prefix)
prefix - characters to removeT removeProperPrefix(CharSequence prefix, boolean ignoreCase)
prefix - characters to removeignoreCase - case ignored when trueT toLowerCase()
T toUpperCase()
T toMapped(CharMapper mapper)
T trimTailBlankLines()
T trimLeadBlankLines()
String toVisibleWhitespaceString()
T[] split(char delimiter, int limit, int flags, String trimChars)
delimiter - delimiter char or set of chars in CharSequence to split this sequence onlimit - max number of segments to splitflags - flags for desired options:
SPLIT_INCLUDE_DELIMS: include delimiters as part of split item
SPLIT_TRIM_PARTS: trim the segments
SPLIT_SKIP_EMPTY: skip empty segments (or empty after trimming if enabled)
SPLIT_INCLUDE_DELIM_PARTS: include delimiters as separate split item of its own
SPLIT_TRIM_SKIP_EMPTY: same as SPLIT_TRIM_PARTS | SPLIT_SKIP_EMPTYtrimChars - set of characters that should be used for trimming individual split resultsT[] split(char delimiter)
T[] split(char delimiter, int limit)
T[] split(char delimiter, int limit, int flags)
T[] split(CharSequence delimiter)
T[] split(CharSequence delimiter, int limit)
T[] split(CharSequence delimiter, int limit, int flags)
T[] split(CharSequence delimiter, int limit, int flags, String trimChars)
int[] indexOfAll(CharSequence s)
s - sequence whose indices to findT replace(CharSequence find, CharSequence replace)
find - sequence to findreplace - replacement sequenceT appendTo(StringBuilder out)
T appendTo(StringBuilder out, int start)
T appendTo(StringBuilder out, int start, int end)
T append(CharSequence... others)
Pair<Integer,Integer> getLineColumnAtIndex(int index)
index - index for which to get line informationint getColumnAtIndex(int index)
Copyright © 2019. All rights reserved.