Top Description Fields Methods
com.vladsch.flexmark.util.sequence

public Interface IRichSequence<T extends IRichSequence<T>>

extends CharSequence, Comparable<CharSequence>, SequenceUtils
Known Direct Subinterfaces
com.vladsch.flexmark.util.sequence.RichSequence, com.vladsch.flexmark.util.sequence.BasedSequence
Known Direct Implementers
com.vladsch.flexmark.util.sequence.IRichSequenceBase
Annotations
@SuppressWarnings:SameParameterValue
Imports
com.vladsch.flexmark.util.misc.CharPredicate, .Pair, com.vladsch.flexmark.util.sequence.builder.ISequenceBuilder, com.vladsch.flexmark.util.sequence.mappers.CharMapper, org.jetbrains.annotations.NotNull, .Nullable, java.util.Collection, .List, java.util.function.BiPredicate, .Predicate

A CharSequence that provides a rich set of manipulation methods.

Note

'\0' changed to '�' use com.vladsch.flexmark.util.sequence.mappers.NullEncoder#decodeNull mapper to get original null chars.

safe access methods return '\0' for no char response.

Field Summary

Inherited from com.vladsch.flexmark.util.sequence.SequenceUtils:
ANY_EOLANY_EOL_SETBACKSLASH_SETDECIMAL_DIGITSEMPTY_INDICESENC_NULEOLEOL_CHAREOL_CHAR1EOL_CHAR2EOL_CHARSEOL_SETHASH_SETHEXADECIMAL_DIGITSLINE_SEPLSLSEPNBSPNBSP_CHARSNULOCTAL_DIGITSSPACESPACE_EOLSPACE_EOL_SETSPACE_SETSPACE_TABSPACE_TAB_EOL_SETSPACE_TAB_NBSP_SETSPACE_TAB_SETSPCSPLIT_INCLUDE_DELIM_PARTSSPLIT_INCLUDE_DELIMSSPLIT_SKIP_EMPTYSPLIT_TRIM_PARTSSPLIT_TRIM_SKIP_EMPTYTAB_SETUSUS_CHARSUS_SETvisibleSpacesMapWHITESPACEWHITESPACE_CHARSWHITESPACE_NBSPWHITESPACE_NBSP_CHARSWHITESPACE_NBSP_SETWHITESPACE_NO_EOL_CHARSWHITESPACE_SET

Method Summary

Modifier and TypeMethod and Description
public T

Returns:

appended sequence
append
(CharSequence...
list of char sequences to append to this sequence, null sequences are skipped
sequences
)

Concatenate this sequence and list of others, returning sequence of result

public T
append(Iterable<? extends CharSequence> sequences)

public T
public T

Returns:

this
appendRangesTo
(@NotNull StringBuilder
string builder to append to
out
,
@Nullable CharMapper
mapping to use for output or null if none
charMapper
,
Range...
ranges to append, null range or one for which range.isNull() is true ranges are skipped
ranges
)

Append given ranges of this sequence to string builder

public T
public T
public T
public T
public T
appendSpaces(int count)

public T

Returns:

this
appendTo
(@NotNull StringBuilder
string builder
out
,
@Nullable CharMapper
mapping to use for output or null if none
charMapper
,
int
start index
startIndex
,
int
end index
endIndex
)

Append helpers

public T
public T
appendTo(@NotNull StringBuilder out, @Nullable CharMapper charMapper, int startIndex)

public T
appendTo(@NotNull StringBuilder out, int startIndex, int endIndex)

public T
public T
appendTo(@NotNull StringBuilder out, int startIndex)

public @NotNull List<Range>
public @NotNull List<Range>
blankLinesRemovedRanges(int fromIndex)

public @NotNull List<Range>
blankLinesRemovedRanges(int fromIndex, int endIndex)

public @NotNull List<Range>
blankLinesRemovedRanges(@NotNull CharPredicate eolChars, int fromIndex, int endIndex)

public int
columnAtIndex(int index)

public int

Returns:

number of chars in contiguous span at start of sequence
countLeading
(@NotNull CharPredicate
predicate for set of contiguous characters which should be counted
chars
)

Count leading/trailing characters of this sequence

Parameters can be CharPredicate, counts any contiguous leading/trailing characters in the sequence which are contained in the given char set.

public int
countLeading(@NotNull CharPredicate chars, int startIndex)

public int
countLeading(@NotNull CharPredicate chars, int startIndex, int endIndex)

public default int

Returns:

leading count
countLeading
(char
char
c
)
Deprecated consider using built-in sets of characters, ..._SET, or Use CharPredicate.anyOf(...)

public default int
countLeading()
Deprecated

public int

Returns:

column of first non-whitespace as given by chars
countLeadingColumns
(int
column of where this sequence starts
startColumn
,
@NotNull CharPredicate
whitespace characters
chars
)

Count column of indent given by chars in the set in this sequence, expanding tabs to 4th column

public int
public int
countLeadingNot(@NotNull CharPredicate chars, int startIndex)

public int
countLeadingNot(@NotNull CharPredicate chars, int startIndex, int endIndex)

public int
public int
countLeadingNotSpace(int startIndex)

public int
countLeadingNotSpace(int startIndex, int endIndex)

public int
public int
countLeadingNotSpaceTab(int startIndex)

public int
countLeadingNotSpaceTab(int startIndex, int endIndex)

public int
public int
countLeadingNotWhitespace(int startIndex)

public int
countLeadingNotWhitespace(int startIndex, int endIndex)

public int
public int
countLeadingSpace(int startIndex)

public int
countLeadingSpace(int startIndex, int endIndex)

public int
public int
countLeadingSpaceTab(int startIndex)

public int
countLeadingSpaceTab(int startIndex, int endIndex)

public int
public int
countLeadingWhitespace(int startIndex)

public int
countLeadingWhitespace(int startIndex, int endIndex)

public default int
countOf(char c)
Deprecated

public int
public int
countOfAny(@NotNull CharPredicate chars, int startIndex)

public int
countOfAny(@NotNull CharPredicate chars, int startIndex, int endIndex)

public int
public int
countOfAnyNot(@NotNull CharPredicate chars, int startIndex)

public int
countOfAnyNot(@NotNull CharPredicate chars, int startIndex, int endIndex)

public int
public int
public int
public int
public int
public int
countTrailing(@NotNull CharPredicate chars, int startIndex)

public int
countTrailing(@NotNull CharPredicate chars, int startIndex, int endIndex)

public default int
countTrailing()
Deprecated

public int
public int
countTrailingNot(@NotNull CharPredicate chars, int startIndex)

public int
countTrailingNot(@NotNull CharPredicate chars, int startIndex, int endIndex)

public int
public int
countTrailingNotSpace(int fromIndex)

public int
countTrailingNotSpace(int startIndex, int fromIndex)

public int
public int
countTrailingNotSpaceTab(int fromIndex)

public int
countTrailingNotSpaceTab(int startIndex, int fromIndex)

public int
public int
public int
countTrailingNotWhitespace(int startIndex, int fromIndex)

public int
public int
countTrailingSpace(int fromIndex)

public int
countTrailingSpace(int startIndex, int fromIndex)

public int
public int
countTrailingSpaceTab(int fromIndex)

public int
countTrailingSpaceTab(int startIndex, int fromIndex)

public int
public int
countTrailingWhitespace(int fromIndex)

public int
countTrailingWhitespace(int startIndex, int fromIndex)

public T

Returns:

resulting sequence
delete
(int
start index of deletion
startIndex
,
int
end index, not inclusive, of insertion
endIndex
)

Delete range in sequence

public T[]
public char

Returns:

character located at length() - index in this sequence
endCharAt
(int
offset from end of sequence
index
)

Convenience method to get characters offset from end of sequence.

public int

Returns:

index of end of region delimited by s
endOfDelimitedBy
(@NotNull CharSequence
character sequence delimiting the region
s
,
int
from which to start looking for end of region
index
)

Find start/end region in this sequence delimited by any characters in argument or the CharSequence

For Any and AnyNot methods uses the CharSequence argument as a character set of possible delimiting characters

public int
public int
public int

Returns:

index of end of line delimited by \n
endOfLine
(int
index where to start searching for end of line
index
)

Get the offset of the end of line at given index, end of line delimited by \n

public int

Returns:

index of end of line delimited by \n
endOfLineAnyEOL
(int
index where to start searching for end of line
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.

public T

Returns:

selected portion spanning length() - startIndex to length() - endIndex of this sequence
endSequence
(int
offset from endIndex of sequence [ 0..length() )
startIndex
,
int
offset from endIndex of sequence [ 0..length() )
endIndex
)

Convenience method to get characters offset from endIndex of sequence.

public T

Returns:

selected portion spanning length() - startIndex to length() of this sequence
endSequence
(int
offset from endIndex of sequence [ 0..length() )
startIndex
)

Convenience method to get characters offset from endIndex of sequence.

public boolean

Returns:

true if ends with suffix
endsWith
(@NotNull CharSequence
characters to test
suffix
)

test if this sequence ends with given characters

public boolean
public boolean

Returns:

true if ends with suffix
endsWith
(@NotNull CharSequence
characters to test
suffix
,
boolean
case ignored when true
ignoreCase
)

test if this sequence ends with given characters

public boolean
public boolean
public boolean

Returns:

true if ends with suffix
endsWithIgnoreCase
(@NotNull CharSequence
characters to test
suffix
)

test if this sequence ends with given characters, ignoring case differences

public boolean
public boolean
public boolean
public int

Returns:

0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
eolEndLength
()

Get the length of EOL character at the end of this sequence, if present.

public int

Returns:

0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
eolEndLength
(int
index where the EOL ends, if any, any value can be passed for this argument. If > length of this sequence then it is the same as passing length(), if 0 or less then 0 is returned.
eolEnd
)

Get the length of EOL character at the given index of this sequence, if present.

public @NotNull Range

Returns:

range of eol given by index of its end or Range.NULL if no eol ends at index
eolEndRange
(int
index where the EOL ends, if any, any value can be passed for this argument. If > length of this sequence then it is the same as passing length(), if 0 or less then 0 is returned.
eolEnd
)

Return Range of eol at given index

public default int
eolLength(int eolStart)
Deprecated

public default int
eolStartLength()
Deprecated

public int

Returns:

0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
eolStartLength
(int
index where the EOL starts, if any, any value can be passed for this argument. If >= length of this sequence then 0 is returned if 0 or less then it is the same as 0
eolStart
)

Get the length of EOL character at the given index of this sequence, if present.

public @NotNull Range

Returns:

range of eol given by index of its end or Range.NULL if no eol starts at index
eolStartRange
(int
index where the EOL starts, if any, any value can be passed for this argument. If >= length of this sequence then 0 is returned if 0 or less then it is the same as 0
eolStart
)

Return Range of eol at given index

public boolean

Returns:

true if character sequences are equal
equals
(@Nullable Object
another char sequence
other
)

Comparison to another CharSequence should result in a match if their contents are equal regardless of the implementation.

public boolean

Returns:

true if match
equals
(@Nullable Object
characters to match against
other
,
boolean
case ignored when true
ignoreCase
)

Test the sequence for a match to another CharSequence

public boolean

Returns:

true if match
equalsIgnoreCase
(@Nullable Object
characters to match against
other
)

Test the sequence for a match to another CharSequence, ignoring case differences

public T

Returns:

resulting sequence
extractRanges
(Range...
ranges to extract
ranges
)

Build a sequence of ranges in this sequence

Note

BasedSequence ranges must be non-overlapping and ordered by startOffset or IllegalArgumentException will be thrown

public T
public char

Returns:

the first character of the sequence or '\0' if empty
firstChar
()

public <
type of builder
B extends ISequenceBuilder<B, T>
>
B

Returns:

builder which can build this type of sequence
getBuilder
()

Get a sequence builder for this sequence type

public default int
getColumnAtIndex(int index)
Deprecated

public default @NotNull Pair<Integer, Integer>
getLineColumnAtIndex(int index)
Deprecated

public int

Returns:

hash code as if it was a string of the sequence content
hashCode
()

Should return hashCode of the underlying character sequence which is equal to the String value of that sequence

public T

Returns:

this or other
ifNull
(T
based sequence to return if this is nullSequence()
other
)

If this sequence is the nullSequence() instance then returns other, otherwise returns this sequence.

public T

Returns:

this or other.subSequence(other.length(), other.length())
ifNullEmptyAfter
(T
based sequence from which to take the empty sequence
other
)

If this sequence is the nullSequence() instance then returns an empty subSequence from the end of other, otherwise returns this sequence.

public T

Returns:

this or other.subSequence(0, 0)
ifNullEmptyBefore
(T
based sequence from which to take the empty sequence
other
)

If this sequence is the nullSequence() instance then returns an empty subSequence from the start of other, otherwise returns this sequence.

public int

Returns:

index where found or -1
indexOf
(@NotNull CharSequence
character pre whose occurrence to find
s
)

All index methods return the position or -1 if not found of the given character, characters or string.

public int
indexOf(@NotNull CharSequence s, int fromIndex)

public int
indexOf(@NotNull CharSequence s, int fromIndex, int endIndex)

public int
indexOf(char c, int fromIndex, int endIndex)

public int
indexOf(char c, int fromIndex)

public int
indexOf(char c)

public @NotNull int[]

Returns:

array of indices
indexOfAll
(@NotNull CharSequence
sequence whose indices to find
s
)

Get indices of all occurrences of a sequence

public int
indexOfAny(@NotNull CharPredicate s, int fromIndex, int endIndex)

public int
indexOfAny(@NotNull CharPredicate s, int fromIndex)

public int
public int
indexOfAnyNot(@NotNull CharPredicate s, int fromIndex, int endIndex)

public int
public int
public int
indexOfNot(char c, int fromIndex, int endIndex)

public int
indexOfNot(char c, int fromIndex)

public int
indexOfNot(char c)

public T

Returns:

resulting sequence based sequence implementation may throw an IllegalArgumentException if inserting another based sequence out of order based on offsets
insert
(int
index of insertion. if >length of this sequence then same as length, if <0 then same as 0
index
,
@NotNull CharSequence
char sequence to insert
chars
)

Insert char sequence at given index

public default T

Returns:

resulting sequence
insert
(@NotNull CharSequence
chars
chars
,
int
index of insertion
index
)
Deprecated use insert(int, CharSequence) instead

public boolean
public boolean

Returns:

true if character at index tests true
isCharAt
(int
index in string
index
,
@NotNull CharPredicate
character set predicate
predicate
)

Safe, if index out of range returns '\0'

public boolean
isEmpty()

Redeclares as abstract: java.lang.CharSequence.isEmpty.

Returns true if this character sequence is empty.

public boolean
isIn(@NotNull String[] texts)

public boolean
public boolean
public boolean
public boolean
public boolean
public char

Returns:

the last character of the sequence or '\0' if empty
lastChar
()

public int
public int
lastIndexOf(@NotNull CharSequence s, int fromIndex)

public int
lastIndexOf(@NotNull CharSequence s, int startIndex, int fromIndex)

public int
lastIndexOf(char c, int startIndex, int fromIndex)

public int
lastIndexOf(char c, int fromIndex)

public int
lastIndexOf(char c)

public int
lastIndexOfAny(@NotNull CharPredicate s, int startIndex, int fromIndex)

public int
public int
public int
lastIndexOfAnyNot(@NotNull CharPredicate s, int startIndex, int fromIndex)

public int
public int
public int
public int
lastIndexOfNot(char c, int fromIndex)

public int
lastIndexOfNot(char c, int startIndex, int fromIndex)

public @NotNull Range

Returns:

range of blank lines at or before fromIndex and ranging to minimum of startIndex, Range.NULL if none found if the range in sequence contains only whitespace characters then the whole range will be returned even if contains no EOL characters
leadingBlankLinesRange
(@NotNull CharPredicate
characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
eolChars
,
int
minimum index in sequence to check and include in range of blank lines can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
fromIndex
,
int
index in sequence from which to start blank line search, also maximum index to include in blank lines range can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
endIndex
)

Get Range of leading blank lines at given index offsets in sequence

public @NotNull Range
public @NotNull Range
leadingBlankLinesRange(int startIndex)

public @NotNull Range
leadingBlankLinesRange(int fromIndex, int endIndex)

public T

Returns:

sub-sequence for the line containing index
lineAt
(int
index at which to get the line
index
)

Get the line characters at given index, line delimited by \n

public T

Returns:

sub-sequence for the line containing index
lineAtAnyEOL
(int
index at which to get the line
index
)

Get the line characters at given index, line delimited by \n, \r or \r\n

public @NotNull Pair<Integer, Integer>

Returns:

Pair(line, column) where line and column are 0 based, throws IllegalArgumentException if index < 0 or > length.
lineColumnAtIndex
(int
index for which to get line information
index
)

Get the line and column information from index into sequence

public @NotNull Range

Returns:

range in sequence for the line delimited by '\n', containing index
lineRangeAt
(int
index at which to get the line
index
)

Get the line characters at given index, line delimited by \n

public @NotNull Range

Returns:

range in sequence for the line delimited by end of line, containing index
lineRangeAtAnyEOL
(int
index at which to get the line
index
)

Get the line characters at given index, line delimited by \n, \r or \r\n

public boolean

Returns:

true if characters at the start of this sequence match
matchChars
(@NotNull CharSequence
characters to match against
chars
)

Test the sequence portion for a match to another CharSequence

public boolean
matchChars(@NotNull CharSequence chars, boolean ignoreCase)

public boolean

Returns:

true if characters at the start index of this sequence match
matchChars
(@NotNull CharSequence
characters to match against
chars
,
int
index from which to start the match
startIndex
,
boolean
if true match ignoring case differences
ignoreCase
)

Test the sequence portion for a match to another CharSequence

public boolean
matchChars(@NotNull CharSequence chars, int startIndex)

public boolean
public boolean
public boolean

Returns:

true if characters at the start index of this sequence match
matchCharsReversed
(@NotNull CharSequence
characters to match against
chars
,
int
index from which to start the match and proceed to 0
endIndex
,
boolean
if true match ignoring case differences
ignoreCase
)

Test the sequence portion for a match to another CharSequence, reverse order

public boolean
public boolean
public int

Returns:

count of characters at the start index of this sequence matching corresponding characters in chars
matchedCharCount
(@NotNull CharSequence
characters to match against
chars
,
int
index from which to start the match
startIndex
,
int
index at which to end the matching
endIndex
,
boolean
if true will do quick fail if length of chars is longer than characters after startIndex in this sequence
fullMatchOnly
,
boolean
if true match ignoring case differences
ignoreCase
)

Test the sequence portion for a match to another CharSequence

public int
matchedCharCount(@NotNull CharSequence chars, int startIndex, int endIndex, boolean ignoreCase)

public int
matchedCharCount(@NotNull CharSequence chars, int startIndex, boolean ignoreCase)

public int
matchedCharCount(@NotNull CharSequence chars, int startIndex, int endIndex)

public int
matchedCharCount(@NotNull CharSequence chars, int startIndex)

public int
matchedCharCountIgnoreCase(@NotNull CharSequence chars, int startIndex, int endIndex)

public int
public int

Returns:

count of characters at the from index of this sequence matching corresponding characters in chars in reverse order
matchedCharCountReversed
(@NotNull CharSequence
characters to match against
chars
,
int
index at which to stop the match
startIndex
,
int
index from which to start the match, not inclusive, matching starts at fromIndex-1 and proceeds towards 0
fromIndex
,
boolean
if true match ignoring case differences
ignoreCase
)

Test the sequence portion for a match to another CharSequence, equivalent to taking this.subSequence(startIndex, fromIndex) and then count matching chars going from end of both sequences

public int
matchedCharCountReversed(@NotNull CharSequence chars, int startIndex, int fromIndex)

public int
matchedCharCountReversed(@NotNull CharSequence chars, int fromIndex, boolean ignoreCase)

public int
public int
matchedCharCountReversedIgnoreCase(@NotNull CharSequence chars, int startIndex, int fromIndex)

public int
public boolean

Returns:

true if match
matches
(@NotNull CharSequence
characters to match against
chars
)

Test the sequence for a match to another CharSequence

public boolean
matches(@NotNull CharSequence chars, boolean ignoreCase)

public boolean
public char

Returns:

character at index or \0 if index is outside valid range for this sequence
midCharAt
(int
of character to get
index
)

Convenience method to get characters offset from start or end of sequence.

public T

Returns:

selected portion spanning startIndex to endIndex of this sequence. If offset is <0 then it is taken as relative to length()
midSequence
(int
offset into this sequence
startIndex
,
int
offset into this sequence
endIndex
)

Convenience method to get characters offset from start or end of sequence.

public T

Returns:

selected portion spanning startIndex to length() of this sequence. If offset is <0 then it is taken as relative to length()
midSequence
(int
offset into this sequence
startIndex
)

Convenience method to get characters offset from start or end of sequence.

public @NotNull String

Returns:

string with only \n for line separators and terminated by \n
normalizeEndWithEOL
()

replace any \r\n and \r by \n, append terminating EOL if one is not present

public @NotNull String

Returns:

string with only \n for line separators
normalizeEOL
()

replace any \r\n and \r by \n

public T

Returns:

this or nullSequence()
nullIf
(boolean
when true return NULL else this
condition
)

If condition is true return nullSequence() otherwise returns this sequence.

public T

Returns:

this or nullSequence()
nullIf
(@NotNull BiPredicate<? super T, ? super CharSequence>
bi predicate for test, first argument is always this, second is one of the match sequences
predicate
,
CharSequence...
match sequence list
matches
)

If predicate returns true for this sequence and one of given sequences return nullSequence() otherwise returns this sequence.

public T

Returns:

this or nullSequence()
nullIf
(@NotNull Predicate<? super CharSequence>
sequence predicate
predicate
,
CharSequence...
match sequence list
matches
)

If predicate returns true for one of given sequences return nullSequence() otherwise returns this sequence.

public T

Returns:

this or nullSequence()
nullIf
(CharSequence...
match sequence list
matches
)

If this sequence matches one of given sequences return nullSequence() otherwise returns this sequence.

public T

Returns:

this or nullSequence()
nullIfBlank
()

If this sequence is blank return nullSequence() otherwise returns this sequence.

public T

Returns:

this or nullSequence()
nullIfEmpty
()

If this sequence is empty return nullSequence() otherwise returns this sequence.

public T
public T
nullIfEndsWith(boolean ignoreCase, CharSequence... matches)

public T
public default T
nullIfEndsWithNot(CharSequence... matches)
Deprecated

public T
nullIfNot(@NotNull BiPredicate<? super T, ? super CharSequence> predicate, CharSequence... matches)

public T
nullIfNot(@NotNull Predicate<? super CharSequence> predicate, CharSequence... matches)

public T
nullIfNot(CharSequence... matches)

public T
public T
nullIfNotEndsWith(boolean ignoreCase, CharSequence... matches)

public T
public T
public T
nullIfNotStartsWith(boolean ignoreCase, CharSequence... matches)

public T
public T
public T
nullIfStartsWith(boolean ignoreCase, CharSequence... matches)

public T
public default T
nullIfStartsWithNot(CharSequence... matches)
Deprecated

public T
public T

Returns:

padding chars
padding
(int
length
length
,
char
char to use for padding
pad
)

Get the chars needed for padding to length

public T
padding(int length)

public T
padEnd(int length, char pad)

public T
padEnd(int length)

public T

Returns:

sequence padded
padStart
(int
length to pad
length
,
char
char to use for padding
pad
)

Pad this sequence to given length

public T
padStart(int length)

public T

Returns:

resulting sequence
prefixOnceWith
(@Nullable CharSequence
char sequence
prefix
)

Prefix this sequence with a char sequence if not already starting with prefix

public T
public T
public T

Returns:

resulting sequence
prefixWith
(@Nullable CharSequence
char sequence
prefix
)

Prefix this sequence with a char sequence

public T
public T
public T
prefixWithSpaces(int count)

public T

Returns:

sequence with prefix removed, or same sequence if no prefix was present
removePrefix
(@NotNull CharSequence
characters to remove
prefix
)

Remove prefix if present

public T

Returns:

sequence with prefix removed, or same sequence if no prefix was present
removePrefix
(@NotNull CharSequence
characters to remove
prefix
,
boolean
case ignored when true
ignoreCase
)

Remove prefix if present

public T

Returns:

sequence with prefix removed, or same sequence if no prefix was present
removePrefixIgnoreCase
(@NotNull CharSequence
characters to remove
prefix
)

Remove prefix if present, ignoring case differences

public T

Returns:

sequence with prefix removed, or same sequence if no prefix was present
removeProperPrefix
(@NotNull CharSequence
characters to remove
prefix
)

Remove prefix if present but only if this sequence is longer than the suffix

public T

Returns:

sequence with prefix removed, or same sequence if no prefix was present
removeProperPrefix
(@NotNull CharSequence
characters to remove
prefix
,
boolean
case ignored when true
ignoreCase
)

Remove prefix if present but only if this sequence is longer than the suffix

public T

Returns:

sequence with prefix removed, or same sequence if no prefix was present
removeProperPrefixIgnoreCase
(@NotNull CharSequence
characters to remove
prefix
)

Remove prefix if present but only if this sequence is longer than the suffix, ignoring case differences

public T

Returns:

sequence with suffix removed, or same sequence if no suffix was present
removeProperSuffix
(@NotNull CharSequence
characters to remove
suffix
)

Remove suffix if present but only if this sequence is longer than the suffix

public T

Returns:

sequence with suffix removed, or same sequence if no suffix was present
removeProperSuffix
(@NotNull CharSequence
characters to remove
suffix
,
boolean
case ignored when true
ignoreCase
)

Remove suffix if present but only if this sequence is longer than the suffix

public T

Returns:

sequence with suffix removed, or same sequence if no suffix was present
removeProperSuffixIgnoreCase
(@NotNull CharSequence
characters to remove
suffix
)

Remove suffix if present but only if this sequence is longer than the suffix, ignoring case differences

public T

Returns:

sequence with suffix removed, or same sequence if no suffix was present
removeSuffix
(@NotNull CharSequence
characters to remove
suffix
)

Remove suffix if present

public T

Returns:

sequence with suffix removed, or same sequence if no suffix was present
removeSuffix
(@NotNull CharSequence
characters to remove
suffix
,
boolean
case ignored when true
ignoreCase
)

Remove suffix if present

public T

Returns:

sequence with suffix removed, or same sequence if no suffix was present
removeSuffixIgnoreCase
(@NotNull CharSequence
characters to remove
suffix
)

Remove suffix if present, ignoring case differences

public T

Returns:

resulting sequence
replace
(int
start index of replaced part
startIndex
,
int
end index of replaced part
endIndex
,
@NotNull CharSequence
char sequence
replacement
)

Replace part of the sequence with a char sequence

public T

Returns:

array of indices
replace
(@NotNull CharSequence
sequence to find
find
,
@NotNull CharSequence
replacement sequence
replace
)

Replace all occurrences of one sequence with another

public char

Returns:

char or '\0'
safeCharAt
(int
index
index
)

return char at index or '\0' if index <0 or >=length()

public T

Returns:

based sequence whose contents reflect the selected portion
safeSubSequence
(int
offset from startIndex of this sequence
startIndex
,
int
offset from startIndex of this sequence
endIndex
)

Get a portion of this sequence, if index < 0 use 0, if > length() use length

Note

the returned value should only depend on start/end indices.

public T

Returns:

based sequence whose contents reflect the selected portion
safeSubSequence
(int
offset from startIndex of this sequence
startIndex
)

Get a portion of this sequence, if index < 0 use 0, if > length() use length

Note

the returned value should only depend on start/end indices.

public T

Returns:

rich char sequence from given inputs
sequenceOf
(@Nullable CharSequence
char sequence from which to construct a rich char sequence
charSequence
)

Factory function

public T

Returns:

rich char sequence from given inputs
sequenceOf
(@Nullable CharSequence
char sequence from which to construct a rich char sequence
charSequence
,
int
start index of the sequence to use
startIndex
)

Factory function

public T

Returns:

rich char sequence from given inputs
sequenceOf
(@Nullable CharSequence
char sequence from which to construct a rich char sequence
charSequence
,
int
start index of the sequence to use
startIndex
,
int
end index of the sequence to use
endIndex
)

Factory function

public T[]
split(@NotNull CharSequence delimiter, int limit, int flags, @Nullable CharPredicate trimChars)

public T[]
split(@NotNull CharSequence delimiter, int limit, int flags)

public T[]
public default T[]
split(char delimiter, int limit, int flags)
Deprecated

public default T[]
split(char delimiter, int limit)
Deprecated

public default T[]
split(char delimiter)
Deprecated

public T[]
split(@NotNull CharSequence delimiter, int limit, boolean includeDelims, @Nullable CharPredicate trimChars)

public T[]
split(@NotNull CharSequence delimiter, boolean includeDelims, @Nullable CharPredicate trimChars)

public T[]
public T[]
splitEOL(boolean includeDelims)

public @NotNull List<T>

Returns:

List of split results
splitList
(@NotNull CharSequence
delimiter char sequence to use for splitting
delimiter
,
int
max number of segments to split
limit
,
int
flags for desired options: SPLIT_INCLUDE_DELIMS: include delimiters as part of split item SPLIT_TRIM_PARTS: trim the segments, if trimChars is not null or empty then this flag is turned on automatically 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_EMPTY
flags
,
@Nullable CharPredicate
set of characters that should be used for trimming individual split results
trimChars
)

Split helpers based on delimiter character sets contained in CharSequence

public @NotNull List<T>
splitList(@NotNull CharSequence delimiter, int limit, int flags)

public @NotNull List<T>
public @NotNull List<T>

Returns:

List of split results
splitList
(@NotNull CharSequence
sequence of chars on which to split this sequence
delimiter
,
int
max number of segments to split
limit
,
boolean
if true include delimiters as part of split item
includeDelims
,
@Nullable CharPredicate
set of characters that should be used for trimming individual split results
trimChars
)

Split helpers based on delimiter character sets contained in CharPredicate

public @NotNull List<T>
splitList(@NotNull CharSequence delimiter, boolean includeDelims, @Nullable CharPredicate trimChars)

public @NotNull List<T>
public @NotNull List<T>
public @NotNull List<T>
splitListEOL(boolean includeDelims, @Nullable CharPredicate trimChars)

public int
public int
public int
public int

Returns:

index of end of line delimited by \n
startOfLine
(int
index where to start searching for end of line
index
)

Get the offset of the start of line at given index, start of line delimited by \n

public int

Returns:

index of end of line delimited by \n
startOfLineAnyEOL
(int
index where to start searching for end of line
index
)

Get the offset of the start of line at given index, start of line delimited by \n or any of \n \r \r\n for Any methods.

public boolean

Returns:

true if starts with prefix
startsWith
(@NotNull CharSequence
characters to test
prefix
)

test if this sequence starts with given characters

public boolean
public boolean

Returns:

true if starts with prefix
startsWith
(@NotNull CharSequence
characters to test
prefix
,
boolean
case ignored when true
ignoreCase
)

test if this sequence starts with given characters

public boolean
public boolean
public boolean

Returns:

true if starts with prefix
startsWithIgnoreCase
(@NotNull CharSequence
characters to test
prefix
)

test if this sequence starts with given characters, ignoring case differences

public boolean
public boolean
public boolean
public T

Returns:

based sequence whose contents reflect the selected portion
subSequence
(int
offset from startIndex of this sequence
startIndex
,
int
offset from startIndex of this sequence
endIndex
)

Hides com.vladsch.flexmark.util.sequence.SequenceUtils.subSequence.

Redeclares java.lang.CharSequence.subSequence.

Get a portion of this sequence

Note

the returned value should only depend on start/end indices.

public T

Returns:

based sequence whose contents reflect the selected portion, if range.isNull() then nullSequence()
subSequence
(@NotNull Range
range to get, coordinates offset form start of this sequence
range
)

Get a portion of this sequence selected by range

public T

Returns:

based sequence whose contents reflect the selected portion
subSequence
(int
offset from startIndex of this sequence
startIndex
)

Get a portion of this sequence starting from a given offset to endIndex of the sequence

public T

Returns:

based sequence whose contents reflect the selected portion, if range.isNull() then nullSequence()
subSequenceAfter
(@NotNull Range
range to get, coordinates offset form start of this sequence
range
)

Get a portion of this sequence after one selected by range

public T

Returns:

based sequence whose contents reflect the selected portion, if range.isNull() then nullSequence()
subSequenceBefore
(@NotNull Range
range to get, coordinates offset form start of this sequence
range
)

Get a portion of this sequence before one selected by range

public T

Returns:

resulting sequence
suffixOnceWith
(@Nullable CharSequence
char sequence
suffix
)

Suffix this sequence with a char sequence if not already ending with suffix

public T
public T
public T

Returns:

resulting sequence
suffixWith
(@Nullable CharSequence
char sequence
suffix
)

Prefix this sequence with a char sequence

public T
public T
public T
suffixWithSpaces(int count)

public T

Returns:

lowercase version of sequence
toLowerCase
()

Map characters of this sequence to: Uppercase, Lowercase or use custom mapping

public T
public T

Returns:

mapped sequence with spc changed to NbSp
toNbSp
()

Map spaces to non break spaces

public T

Returns:

mapped sequence with NbSp changed to spc
toSpc
()

Map non break spaces to spaces

public @Nullable String

Returns:

string or null if BaseSequence.NULL
toStringOrNull
()

Return string or null if BaseSequence.NULL

public T
public @NotNull String
public @NotNull Range

Returns:

range of blank lines at or before fromIndex and ranging to minimum of startIndex if the range in sequence contains only whitespace characters then the whole range will be returned even if contains no EOL characters
trailingBlankLinesRange
(CharPredicate
characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
eolChars
,
int
index in sequence from which to start blank line search, also maximum index to include in blank lines range can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
startIndex
,
int
maximum index in sequence to check and include in range of blank lines can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
fromIndex
)

Get Range of trailing blank lines at given index offsets in sequence

public @NotNull Range
public @NotNull Range
trailingBlankLinesRange(int fromIndex)

public @NotNull Range
trailingBlankLinesRange(int startIndex, int fromIndex)

public T
trim(int keep, @NotNull CharPredicate chars)

public T
public T
public T
trim()

public T
trimEnd(int keep, @NotNull CharPredicate chars)

public T
public T
public T
public @NotNull Range
public @NotNull Range
public @NotNull Range
trimEndRange(int keep)

public @NotNull Range
public T

Returns:

sequence with one EOL trimmed off if it had one
trimEOL
()

Trim last eol at the end of this sequence,

public T
public @NotNull Pair<T, T>
trimmed(int keep, @NotNull CharPredicate chars)

public @NotNull Pair<T, T>
public @NotNull Pair<T, T>
public @NotNull Pair<T, T>
public T
public T
public T
public T
public T

Returns:

trimmed off EOL if sequence had one or nullSequence()
trimmedEOL
()

Get Trimmed part by trimEOL()

public T

Returns:

part of the sequence that was trimmed from the start
trimmedStart
(int
minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
keep
,
@NotNull CharPredicate
set of characters to trim from start of line
chars
)

Get the characters Trimmed, Trimmed from start/end of this sequence, characters to trim are passed in the sequence argument

returns trimmed sequence or if nothing matched the original sequence

The pair returning functions return before and after sequence

public T
public T
public T
public @NotNull Range
trimRange(int keep, @NotNull CharPredicate chars)

public @NotNull Range
public @NotNull Range
trimRange(int keep)

public @NotNull Range
public T

Returns:

sequence after it is trimmed
trimStart
(int
minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
keep
,
@NotNull CharPredicate
set of characters to trim from start of line
chars
)

Trim, Trim start/end of this sequence, characters to trim are passed in the sequence argument

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 are assumed.

public T
public T
public T
public @NotNull Range

Returns:

range in this sequence to keep or Range.NULL if to keep all
trimStartRange
(int
minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
keep
,
@NotNull CharPredicate
set of characters to trim from start of line
chars
)

Range of kept sequence when trim start/end of this sequence is performed, characters to trim are passed in the sequence argument

returns range of kept sequence or if nothing matched then Range.NULL is returned, meaning keep all

If character set in the form of character sequence is not passed in the WHITESPACE are assumed.

public @NotNull Range
public @NotNull Range
trimStartRange(int keep)

public @NotNull Range
public T

Returns:

return sequence with trailing blank lines trimmed off
trimTailBlankLines
()

Trim leading trailing blank lines in this sequence

public T

Returns:

trimmed version of the sequence to given EOL or the original sequence
trimToEndOfLine
(@NotNull CharPredicate
characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
eolChars
,
boolean
true if EOL is to be included in the line
includeEol
,
int
index for offset contained by the line can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
index
)

Trim end to end of line containing index

public T
trimToEndOfLine(boolean includeEol, int index)

public T
trimToEndOfLine(boolean includeEol)

public T
trimToEndOfLine(int index)

public T
public T

Returns:

trimmed version of the sequence to given EOL or the original sequence
trimToStartOfLine
(@NotNull CharPredicate
characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
eolChars
,
boolean
true if EOL is to be included in the line
includeEol
,
int
index for offset contained by the line can be any value, if less than 0 it is the same as 0, if greater than length() it is the same as length()
index
)

Trim start to start of line containing index

public T
trimToStartOfLine(boolean includeEol, int index)

public T
trimToStartOfLine(boolean includeEol)

public T
trimToStartOfLine(int index)

public T
Inherited from com.vladsch.flexmark.util.sequence.SequenceUtils:
blankLinesRemovedRangesblankLinesRemovedRangesblankLinesRemovedRangesblankLinesRemovedRangescolumnAtIndexcolumnsToNextTabStopcomparecomparecomparecompareReversedcontainedBycontainedBycontainsAnycontainsAnycontainsAnyNotcontainsAnyNotcontainsAnyNotcountLeadingcountLeadingcountLeadingcountLeadingColumnscountLeadingNotcountLeadingNotcountLeadingNotcountLeadingNotSpacecountLeadingNotSpacecountLeadingNotSpacecountLeadingNotSpaceTabcountLeadingNotSpaceTabcountLeadingNotSpaceTabcountLeadingNotWhitespacecountLeadingNotWhitespacecountLeadingNotWhitespacecountLeadingSpacecountLeadingSpacecountLeadingSpacecountLeadingSpaceTabcountLeadingSpaceTabcountLeadingSpaceTabcountLeadingWhitespacecountLeadingWhitespacecountLeadingWhitespacecountOfAnycountOfAnycountOfAnycountOfAnyNotcountOfAnyNotcountOfAnyNotcountOfNotSpaceTabcountOfNotWhitespacecountOfSpaceTabcountOfWhitespacecountTrailingcountTrailingcountTrailingcountTrailingNotcountTrailingNotcountTrailingNotcountTrailingNotSpacecountTrailingNotSpacecountTrailingNotSpacecountTrailingNotSpaceTabcountTrailingNotSpaceTabcountTrailingNotSpaceTabcountTrailingNotWhitespacecountTrailingNotWhitespacecountTrailingNotWhitespacecountTrailingSpacecountTrailingSpacecountTrailingSpacecountTrailingSpaceTabcountTrailingSpaceTabcountTrailingSpaceTabcountTrailingWhitespacecountTrailingWhitespacecountTrailingWhitespaceendOfDelimitedByendOfDelimitedByAnyendOfDelimitedByAnyNotendOfLineendOfLineAnyEOLendsWithendsWithendsWithendsWithAnyEOLendsWithEOLendsWithSpaceendsWithSpaceTabendsWithWhitespaceeolEndLengtheolEndLengtheolEndRangeeolStartLengtheolStartRangeequalsexpandTofirstChargetVisibleSpacesMaphashCodeindexOfindexOfindexOfindexOfindexOfindexOfindexOfAllindexOfAnyindexOfAnyindexOfAnyindexOfAnyNotindexOfAnyNotindexOfAnyNotindexOfNotindexOfNotindexOfNotisBlankisEmptyisNotBlankisNotEmptyisVisibleWhitespacelastCharlastIndexOflastIndexOflastIndexOflastIndexOflastIndexOflastIndexOflastIndexOfAnylastIndexOfAnylastIndexOfAnylastIndexOfAnyNotlastIndexOfAnyNotlastIndexOfAnyNotlastIndexOfNotlastIndexOfNotlastIndexOfNotleadingBlankLinesRangeleadingBlankLinesRangeleadingBlankLinesRangeleadingBlankLinesRangelineColumnAtIndexlineRangeAtlineRangeAtAnyEOLmatchCharsmatchCharsmatchCharsmatchCharsmatchCharsIgnoreCasematchCharsIgnoreCasematchCharsReversedmatchCharsReversedmatchCharsReversedIgnoreCasematchedCharCountmatchedCharCountmatchedCharCountmatchedCharCountmatchedCharCountmatchedCharCountIgnoreCasematchedCharCountIgnoreCasematchedCharCountReversedmatchedCharCountReversedmatchedCharCountReversedmatchedCharCountReversedmatchedCharCountReversedIgnoreCasematchedCharCountReversedIgnoreCasematchesmatchesmatchesIgnoreCasepadEndpadEndpadStartpadStartparseIntOrDefaultparseIntOrDefaultparseIntOrNullparseIntOrNullparseLongOrNullparseLongOrNullparseNumberOrNullparseNumberPrefixOrNullparseUnsignedIntOrDefaultparseUnsignedIntOrDefaultparseUnsignedIntOrNullparseUnsignedIntOrNullsafeCharAtsplitsplitsplitsplitsplitsplitEOLsplitEOLsplitListsplitListsplitListsplitListsplitListsplitListEOLsplitListEOLstartOfDelimitedBystartOfDelimitedByAnystartOfDelimitedByAnyNotstartOfLinestartOfLineAnyEOLstartsWithstartsWithstartsWithstartsWithAnyEOLstartsWithEOLstartsWithSpacestartsWithSpaceTabstartsWithWhitespacesubSequencesubSequenceAftersubSequenceBeforesubSequenceBeforeAftertoStringArraytoVisibleWhitespaceStringtrailingBlankLinesRangetrailingBlankLinesRangetrailingBlankLinesRangetrailingBlankLinesRangetrimtrimtrimtrimEndtrimEndtrimEndtrimEndRangetrimEndRangetrimEndRangetrimEndRangetrimEOLtrimLeadBlankLinestrimmedtrimmedtrimmedtrimmedEndtrimmedEndtrimmedEndtrimmedEOLtrimmedStarttrimmedStarttrimmedStarttrimRangetrimRangetrimRangetrimRangetrimStarttrimStarttrimStarttrimStartRangetrimStartRangetrimStartRangetrimStartRangetrimTailBlankLinestruncateTovalidateIndexvalidateIndexInclusiveEndvalidateStartEnd
Inherited from java.lang.CharSequence:
charAtcharscodePointscomparelengthtoString
Inherited from java.lang.Comparable:
compareTo