Interface IRichSequence<T extends IRichSequence<T>>

    • Method Detail

      • equals

        boolean equals​(@Nullable
                       @Nullable Object other)
        Comparison to another CharSequence should result in a match if their contents are equal regardless of the implementation. Should not resort to content comparison unless
        Overrides:
        equals in class Object
        Parameters:
        other - another char sequence
        Returns:
        true if character sequences are equal
      • hashCode

        int hashCode()
        Should return hashCode of the underlying character sequence which is equal to the String value of that sequence
        Overrides:
        hashCode in class Object
        Returns:
        hash code as if it was a string of the sequence content
      • emptyArray

        @NotNull
        @NotNull T[] emptyArray()
      • nullSequence

        @NotNull
        T nullSequence()
      • lastChar

        char lastChar()
        Returns:
        the last character of the sequence or '\0' if empty
      • firstChar

        char firstChar()
        Returns:
        the first character of the sequence or '\0' if empty
      • safeCharAt

        char safeCharAt​(int index)
        return char at index or '\0' if index <0 or >=length()
        Parameters:
        index - index
        Returns:
        char or '\0'
      • subSequence

        @NotNull
        T subSequence​(int startIndex,
                      int endIndex)
        Get a portion of this sequence

        NOTE: the returned value should only depend on start/end indices. If a subsequence of this sequence with matching start/end should equal (using equals()) all such subsequences of this sequence.

        Specified by:
        subSequence in interface CharSequence
        Parameters:
        startIndex - offset from startIndex of this sequence
        endIndex - offset from startIndex of this sequence
        Returns:
        based sequence whose contents reflect the selected portion
      • safeSubSequence

        @NotNull
        T safeSubSequence​(int startIndex,
                          int 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. If a subsequence of this sequence with matching start/end should equal (using equals()) all such subsequences of this sequence.

        Parameters:
        startIndex - offset from startIndex of this sequence
        endIndex - offset from startIndex of this sequence
        Returns:
        based sequence whose contents reflect the selected portion
      • safeSubSequence

        @NotNull
        T safeSubSequence​(int 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. If a subsequence of this sequence with matching start/end should equal (using equals()) all such subsequences of this sequence.

        Parameters:
        startIndex - offset from startIndex of this sequence
        Returns:
        based sequence whose contents reflect the selected portion
      • subSequence

        @NotNull
        T subSequence​(@NotNull
                      @NotNull Range range)
        Get a portion of this sequence selected by range
        Parameters:
        range - range to get, coordinates offset form start of this sequence
        Returns:
        based sequence whose contents reflect the selected portion, if range.isNull() then nullSequence()
      • subSequenceBefore

        @NotNull
        T subSequenceBefore​(@NotNull
                            @NotNull Range range)
        Get a portion of this sequence before one selected by range
        Parameters:
        range - range to get, coordinates offset form start of this sequence
        Returns:
        based sequence whose contents reflect the selected portion, if range.isNull() then nullSequence()
      • subSequenceAfter

        @NotNull
        T subSequenceAfter​(@NotNull
                           @NotNull Range range)
        Get a portion of this sequence after one selected by range
        Parameters:
        range - range to get, coordinates offset form start of this sequence
        Returns:
        based sequence whose contents reflect the selected portion, if range.isNull() then nullSequence()
      • subSequence

        @NotNull
        T subSequence​(int startIndex)
        Get a portion of this sequence starting from a given offset to endIndex of the sequence
        Parameters:
        startIndex - offset from startIndex of this sequence
        Returns:
        based sequence whose contents reflect the selected portion
      • endSequence

        @NotNull
        T endSequence​(int startIndex,
                      int endIndex)
        Convenience method to get characters offset from endIndex of sequence. no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Parameters:
        startIndex - offset from endIndex of sequence [ 0..length() )
        endIndex - offset from endIndex of sequence [ 0..length() )
        Returns:
        selected portion spanning length() - startIndex to length() - endIndex of this sequence
      • endSequence

        @NotNull
        T endSequence​(int startIndex)
        Convenience method to get characters offset from endIndex of sequence. no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Parameters:
        startIndex - offset from endIndex of sequence [ 0..length() )
        Returns:
        selected portion spanning length() - startIndex to length() of this sequence
      • endCharAt

        char endCharAt​(int index)
        Convenience method to get characters offset from end of sequence. no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Parameters:
        index - offset from end of sequence
        Returns:
        character located at length() - index in this sequence
      • midSequence

        @NotNull
        T midSequence​(int startIndex,
                      int endIndex)
        Convenience method to get characters offset from start or end of sequence. when offset >=0 then it is offset from the start of the sequence, when <0 then from the end

        no exceptions are thrown, instead a \0 is returned for an invalid index positions

        Parameters:
        startIndex - offset into this sequence
        endIndex - offset into this sequence
        Returns:
        selected portion spanning startIndex to endIndex of this sequence. If offset is <0 then it is taken as relative to length()
      • midSequence

        @NotNull
        T midSequence​(int startIndex)
        Convenience method to get characters offset from start or end of sequence. when offset >= then it is offset from the start of the sequence, when <0 then from the end

        no exceptions are thrown, instead a \0 is returned for an invalid index positions

        Parameters:
        startIndex - offset into this sequence
        Returns:
        selected portion spanning startIndex to length() of this sequence. If offset is <0 then it is taken as relative to length()
      • midCharAt

        char midCharAt​(int index)
        Convenience method to get characters offset from start or end of sequence. when index >= then it is offset from the start of the sequence, when <0 then from the end no exceptions are thrown, instead a \0 is returned for an invalid index positions
        Parameters:
        index - of character to get
        Returns:
        character at index or \0 if index is outside valid range for this sequence
      • sequenceOf

        @NotNull
        T sequenceOf​(@Nullable
                     @Nullable CharSequence charSequence)
        Factory function
        Parameters:
        charSequence - char sequence from which to construct a rich char sequence
        Returns:
        rich char sequence from given inputs
      • sequenceOf

        @NotNull
        T sequenceOf​(@Nullable
                     @Nullable CharSequence charSequence,
                     int startIndex)
        Factory function
        Parameters:
        charSequence - char sequence from which to construct a rich char sequence
        startIndex - start index of the sequence to use
        Returns:
        rich char sequence from given inputs
      • sequenceOf

        @NotNull
        T sequenceOf​(@Nullable
                     @Nullable CharSequence charSequence,
                     int startIndex,
                     int endIndex)
        Factory function
        Parameters:
        charSequence - char sequence from which to construct a rich char sequence
        startIndex - start index of the sequence to use
        endIndex - end index of the sequence to use
        Returns:
        rich char sequence from given inputs
      • getBuilder

        @NotNull
        <B extends ISequenceBuilder<B,​T>> B getBuilder()
        Get a sequence builder for this sequence type
        Type Parameters:
        B - type of builder
        Returns:
        builder which can build this type of sequence
      • indexOf

        int indexOf​(@NotNull
                    @NotNull CharSequence s)
        All index methods return the position or -1 if not found of the given character, characters or string.

        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.

        Parameters:
        s - character pre whose occurrence to find
        Returns:
        index where found or -1
      • indexOf

        int indexOf​(@NotNull
                    @NotNull CharSequence s,
                    int fromIndex)
      • indexOf

        int indexOf​(@NotNull
                    @NotNull CharSequence s,
                    int fromIndex,
                    int endIndex)
      • indexOf

        int indexOf​(char c,
                    int fromIndex,
                    int endIndex)
      • indexOf

        int indexOf​(char c,
                    int fromIndex)
      • indexOf

        int indexOf​(char c)
      • indexOfAny

        int indexOfAny​(@NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                       int fromIndex,
                       int endIndex)
      • indexOfAny

        int indexOfAny​(@NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                       int fromIndex)
      • indexOfAny

        int indexOfAny​(@NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate s)
      • indexOfNot

        int indexOfNot​(char c,
                       int fromIndex,
                       int endIndex)
      • indexOfNot

        int indexOfNot​(char c,
                       int fromIndex)
      • indexOfNot

        int indexOfNot​(char c)
      • indexOfAnyNot

        int indexOfAnyNot​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                          int fromIndex,
                          int endIndex)
      • indexOfAnyNot

        int indexOfAnyNot​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                          int fromIndex)
      • indexOfAnyNot

        int indexOfAnyNot​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate s)
      • lastIndexOf

        int lastIndexOf​(@NotNull
                        @NotNull CharSequence s)
      • lastIndexOf

        int lastIndexOf​(@NotNull
                        @NotNull CharSequence s,
                        int fromIndex)
      • lastIndexOf

        int lastIndexOf​(@NotNull
                        @NotNull CharSequence s,
                        int startIndex,
                        int fromIndex)
      • lastIndexOf

        int lastIndexOf​(char c,
                        int startIndex,
                        int fromIndex)
      • lastIndexOf

        int lastIndexOf​(char c,
                        int fromIndex)
      • lastIndexOf

        int lastIndexOf​(char c)
      • lastIndexOfAny

        int lastIndexOfAny​(@NotNull
                           @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                           int startIndex,
                           int fromIndex)
      • lastIndexOfAny

        int lastIndexOfAny​(@NotNull
                           @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                           int fromIndex)
      • lastIndexOfAny

        int lastIndexOfAny​(@NotNull
                           @NotNull com.vladsch.flexmark.util.misc.CharPredicate s)
      • lastIndexOfNot

        int lastIndexOfNot​(char c)
      • lastIndexOfNot

        int lastIndexOfNot​(char c,
                           int fromIndex)
      • lastIndexOfNot

        int lastIndexOfNot​(char c,
                           int startIndex,
                           int fromIndex)
      • lastIndexOfAnyNot

        int lastIndexOfAnyNot​(@NotNull
                              @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                              int startIndex,
                              int fromIndex)
      • lastIndexOfAnyNot

        int lastIndexOfAnyNot​(@NotNull
                              @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                              int fromIndex)
      • lastIndexOfAnyNot

        int lastIndexOfAnyNot​(@NotNull
                              @NotNull com.vladsch.flexmark.util.misc.CharPredicate s)
      • countLeading

        int countLeading​(@NotNull
                         @NotNull com.vladsch.flexmark.util.misc.CharPredicate 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.

        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(CharPredicate): count contiguous leading characters from set in this sequence countLeadingNot(CharPredicate): count contiguous leading characters not from set in this sequence countTrailing(CharPredicate): count contiguous leading characters from set in this sequence countTrailingNot(CharPredicate): count contiguous leading characters not from set in this sequence

        Parameters:
        chars - predicate for set of contiguous characters which should be counted
        Returns:
        number of chars in contiguous span at start of sequence
      • countLeadingNot

        int countLeadingNot​(@NotNull
                            @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • countLeading

        int countLeading​(@NotNull
                         @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                         int startIndex)
      • countLeadingNot

        int countLeadingNot​(@NotNull
                            @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                            int startIndex)
      • countLeading

        int countLeading​(@NotNull
                         @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                         int startIndex,
                         int endIndex)
      • countLeadingNot

        int countLeadingNot​(@NotNull
                            @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                            int startIndex,
                            int endIndex)
      • countLeading

        @Deprecated
        default int countLeading​(char c)
        Deprecated.
        consider using built-in sets of characters, ..._SET, or Use CharPredicate.anyOf(...)
        Parameters:
        c - char
        Returns:
        leading count
      • countTrailing

        int countTrailing​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • countTrailingNot

        int countTrailingNot​(@NotNull
                             @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • countTrailing

        int countTrailing​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                          int startIndex)
      • countTrailingNot

        int countTrailingNot​(@NotNull
                             @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                             int startIndex)
      • countTrailing

        int countTrailing​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                          int startIndex,
                          int endIndex)
      • countTrailingNot

        int countTrailingNot​(@NotNull
                             @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                             int startIndex,
                             int endIndex)
      • countLeadingSpace

        int countLeadingSpace()
      • countLeadingNotSpace

        int countLeadingNotSpace()
      • countLeadingSpace

        int countLeadingSpace​(int startIndex)
      • countLeadingNotSpace

        int countLeadingNotSpace​(int startIndex)
      • countLeadingSpace

        int countLeadingSpace​(int startIndex,
                              int endIndex)
      • countLeadingNotSpace

        int countLeadingNotSpace​(int startIndex,
                                 int endIndex)
      • countTrailingSpace

        int countTrailingSpace()
      • countTrailingNotSpace

        int countTrailingNotSpace()
      • countTrailingSpace

        int countTrailingSpace​(int fromIndex)
      • countTrailingNotSpace

        int countTrailingNotSpace​(int fromIndex)
      • countTrailingSpace

        int countTrailingSpace​(int startIndex,
                               int fromIndex)
      • countTrailingNotSpace

        int countTrailingNotSpace​(int startIndex,
                                  int fromIndex)
      • countLeadingSpaceTab

        int countLeadingSpaceTab()
      • countLeadingNotSpaceTab

        int countLeadingNotSpaceTab()
      • countLeadingSpaceTab

        int countLeadingSpaceTab​(int startIndex)
      • countLeadingNotSpaceTab

        int countLeadingNotSpaceTab​(int startIndex)
      • countLeadingSpaceTab

        int countLeadingSpaceTab​(int startIndex,
                                 int endIndex)
      • countLeadingNotSpaceTab

        int countLeadingNotSpaceTab​(int startIndex,
                                    int endIndex)
      • countTrailingSpaceTab

        int countTrailingSpaceTab()
      • countTrailingNotSpaceTab

        int countTrailingNotSpaceTab()
      • countTrailingSpaceTab

        int countTrailingSpaceTab​(int fromIndex)
      • countTrailingNotSpaceTab

        int countTrailingNotSpaceTab​(int fromIndex)
      • countTrailingSpaceTab

        int countTrailingSpaceTab​(int startIndex,
                                  int fromIndex)
      • countTrailingNotSpaceTab

        int countTrailingNotSpaceTab​(int startIndex,
                                     int fromIndex)
      • countLeadingWhitespace

        int countLeadingWhitespace()
      • countLeadingNotWhitespace

        int countLeadingNotWhitespace()
      • countLeadingWhitespace

        int countLeadingWhitespace​(int startIndex)
      • countLeadingNotWhitespace

        int countLeadingNotWhitespace​(int startIndex)
      • countLeadingWhitespace

        int countLeadingWhitespace​(int startIndex,
                                   int endIndex)
      • countLeadingNotWhitespace

        int countLeadingNotWhitespace​(int startIndex,
                                      int endIndex)
      • countTrailingWhitespace

        int countTrailingWhitespace()
      • countTrailingNotWhitespace

        int countTrailingNotWhitespace()
      • countTrailingWhitespace

        int countTrailingWhitespace​(int fromIndex)
      • countTrailingNotWhitespace

        int countTrailingNotWhitespace​(int fromIndex)
      • countTrailingWhitespace

        int countTrailingWhitespace​(int startIndex,
                                    int fromIndex)
      • countTrailingNotWhitespace

        int countTrailingNotWhitespace​(int startIndex,
                                       int fromIndex)
      • countLeading

        @Deprecated
        default int countLeading()
        Deprecated.
      • countTrailing

        @Deprecated
        default int countTrailing()
        Deprecated.
      • countOfSpaceTab

        int countOfSpaceTab()
      • countOfNotSpaceTab

        int countOfNotSpaceTab()
      • countOfWhitespace

        int countOfWhitespace()
      • countOfNotWhitespace

        int countOfNotWhitespace()
      • countOf

        @Deprecated
        default int countOf​(char c)
        Deprecated.
      • countOfAny

        int countOfAny​(@NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • countOfAnyNot

        int countOfAnyNot​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • countOfAny

        int countOfAny​(@NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                       int startIndex)
      • countOfAnyNot

        int countOfAnyNot​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                          int startIndex)
      • countOfAny

        int countOfAny​(@NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                       int startIndex,
                       int endIndex)
      • countOfAnyNot

        int countOfAnyNot​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars,
                          int startIndex,
                          int endIndex)
      • countLeadingColumns

        int countLeadingColumns​(int startColumn,
                                @NotNull
                                @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
        Count column of indent given by chars in the set in this sequence, expanding tabs to 4th column
        Parameters:
        startColumn - column of where this sequence starts
        chars - whitespace characters
        Returns:
        column of first non-whitespace as given by chars
      • trimStartRange

        @NotNull
        @NotNull Range trimStartRange​(int keep,
                                      @NotNull
                                      @NotNull com.vladsch.flexmark.util.misc.CharPredicate 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 SequenceUtils.WHITESPACE are assumed.

        Parameters:
        keep - minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
        chars - set of characters to trim from start of line
        Returns:
        range in this sequence to keep or Range.NULL if to keep all
      • trimEndRange

        @NotNull
        @NotNull Range trimEndRange​(int keep,
                                    @NotNull
                                    @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimRange

        @NotNull
        @NotNull Range trimRange​(int keep,
                                 @NotNull
                                 @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimStartRange

        @NotNull
        @NotNull Range trimStartRange​(@NotNull
                                      @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimEndRange

        @NotNull
        @NotNull Range trimEndRange​(@NotNull
                                    @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimRange

        @NotNull
        @NotNull Range trimRange​(@NotNull
                                 @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimStartRange

        @NotNull
        @NotNull Range trimStartRange​(int keep)
      • trimEndRange

        @NotNull
        @NotNull Range trimEndRange​(int keep)
      • trimRange

        @NotNull
        @NotNull Range trimRange​(int keep)
      • trimStartRange

        @NotNull
        @NotNull Range trimStartRange()
      • trimEndRange

        @NotNull
        @NotNull Range trimEndRange()
      • trimRange

        @NotNull
        @NotNull Range trimRange()
      • trimStart

        @NotNull
        T trimStart​(int keep,
                    @NotNull
                    @NotNull com.vladsch.flexmark.util.misc.CharPredicate 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 SequenceUtils.WHITESPACE are assumed.

        Parameters:
        keep - minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
        chars - set of characters to trim from start of line
        Returns:
        sequence after it is trimmed
      • trimEnd

        @NotNull
        T trimEnd​(int keep,
                  @NotNull
                  @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trim

        @NotNull
        T trim​(int keep,
               @NotNull
               @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimStart

        @NotNull
        T trimStart​(int keep)
      • trimEnd

        @NotNull
        T trimEnd​(int keep)
      • trim

        @NotNull
        T trim​(int keep)
      • trimStart

        @NotNull
        T trimStart​(@NotNull
                    @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimEnd

        @NotNull
        T trimEnd​(@NotNull
                  @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trim

        @NotNull
        T trim​(@NotNull
               @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimStart

        @NotNull
        T trimStart()
      • trimEnd

        @NotNull
        T trimEnd()
      • trim

        @NotNull
        T trim()
      • trimmedStart

        @NotNull
        T trimmedStart​(int keep,
                       @NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate 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

        Parameters:
        keep - minimum length of would be trimmed characters to keep. ie. keep 4, will leave 0..4 as is but remove any >4
        chars - set of characters to trim from start of line
        Returns:
        part of the sequence that was trimmed from the start
      • trimmedEnd

        @NotNull
        T trimmedEnd​(int keep,
                     @NotNull
                     @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimmed

        @NotNull
        @NotNull com.vladsch.flexmark.util.misc.Pair<T,​T> trimmed​(int keep,
                                                                        @NotNull
                                                                        @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimmedStart

        @NotNull
        T trimmedStart​(int keep)
      • trimmedEnd

        @NotNull
        T trimmedEnd​(int keep)
      • trimmed

        @NotNull
        @NotNull com.vladsch.flexmark.util.misc.Pair<T,​T> trimmed​(int keep)
      • trimmedStart

        @NotNull
        T trimmedStart​(@NotNull
                       @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimmedEnd

        @NotNull
        T trimmedEnd​(@NotNull
                     @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimmed

        @NotNull
        @NotNull com.vladsch.flexmark.util.misc.Pair<T,​T> trimmed​(@NotNull
                                                                        @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • trimmedStart

        @NotNull
        T trimmedStart()
      • trimmedEnd

        @NotNull
        T trimmedEnd()
      • trimmed

        @NotNull
        @NotNull com.vladsch.flexmark.util.misc.Pair<T,​T> trimmed()
      • padding

        @NotNull
        T padding​(int length,
                  char pad)
        Get the chars needed for padding to length
        Parameters:
        length - length
        pad - char to use for padding
        Returns:
        padding chars
      • padding

        @NotNull
        T padding​(int length)
      • padStart

        @NotNull
        T padStart​(int length,
                   char pad)
        Pad this sequence to given length
        Parameters:
        length - length to pad
        pad - char to use for padding
        Returns:
        sequence padded
      • padEnd

        @NotNull
        T padEnd​(int length,
                 char pad)
      • padStart

        @NotNull
        T padStart​(int length)
      • padEnd

        @NotNull
        T padEnd​(int length)
      • isEmpty

        boolean isEmpty()
      • isBlank

        boolean isBlank()
      • isNotEmpty

        boolean isNotEmpty()
      • isNotBlank

        boolean isNotBlank()
      • isNull

        boolean isNull()
      • isNotNull

        boolean isNotNull()
      • ifNull

        @NotNull
        T ifNull​(@NotNull
                 T other)
        If this sequence is the nullSequence() instance then returns other, otherwise returns this sequence.
        Parameters:
        other - based sequence to return if this is nullSequence()
        Returns:
        this or other
      • ifNullEmptyAfter

        @NotNull
        T ifNullEmptyAfter​(@NotNull
                           T other)
        If this sequence is the nullSequence() instance then returns an empty subSequence from the end of other, otherwise returns this sequence.
        Parameters:
        other - based sequence from which to take the empty sequence
        Returns:
        this or other.subSequence(other.length(), other.length())
      • ifNullEmptyBefore

        @NotNull
        T ifNullEmptyBefore​(@NotNull
                            T other)
        If this sequence is the nullSequence() instance then returns an empty subSequence from the start of other, otherwise returns this sequence.
        Parameters:
        other - based sequence from which to take the empty sequence
        Returns:
        this or other.subSequence(0, 0)
      • nullIfEmpty

        @NotNull
        T nullIfEmpty()
        If this sequence is empty return nullSequence() otherwise returns this sequence.
        Returns:
        this or nullSequence()
      • nullIfBlank

        @NotNull
        T nullIfBlank()
        If this sequence is blank return nullSequence() otherwise returns this sequence.
        Returns:
        this or nullSequence()
      • nullIf

        @NotNull
        T nullIf​(boolean condition)
        If condition is true return nullSequence() otherwise returns this sequence.
        Parameters:
        condition - when true return NULL else this
        Returns:
        this or nullSequence()
      • nullIf

        @NotNull
        T nullIf​(@NotNull
                 @NotNull BiPredicate<? super T,​? super CharSequence> predicate,
                 CharSequence... matches)
        If predicate returns true for this sequence and one of given sequences return nullSequence() otherwise returns this sequence.
        Parameters:
        predicate - bi predicate for test, first argument is always this, second is one of the match sequences
        matches - match sequence list
        Returns:
        this or nullSequence()
      • nullIf

        @NotNull
        T nullIf​(@NotNull
                 @NotNull Predicate<? super CharSequence> predicate,
                 CharSequence... matches)
        If predicate returns true for one of given sequences return nullSequence() otherwise returns this sequence.
        Parameters:
        predicate - sequence predicate
        matches - match sequence list
        Returns:
        this or nullSequence()
      • nullIf

        @NotNull
        T nullIf​(CharSequence... matches)
        If this sequence matches one of given sequences return nullSequence() otherwise returns this sequence.
        Parameters:
        matches - match sequence list
        Returns:
        this or nullSequence()
      • nullIfStartsWith

        @NotNull
        T nullIfStartsWith​(CharSequence... matches)
      • nullIfNotStartsWith

        @NotNull
        T nullIfNotStartsWith​(CharSequence... matches)
      • nullIfEndsWith

        @NotNull
        T nullIfEndsWith​(CharSequence... matches)
      • nullIfNotEndsWith

        @NotNull
        T nullIfNotEndsWith​(CharSequence... matches)
      • nullIfStartsWithIgnoreCase

        @NotNull
        T nullIfStartsWithIgnoreCase​(CharSequence... matches)
      • nullIfNotStartsWithIgnoreCase

        @NotNull
        T nullIfNotStartsWithIgnoreCase​(CharSequence... matches)
      • nullIfEndsWithIgnoreCase

        @NotNull
        T nullIfEndsWithIgnoreCase​(CharSequence... matches)
      • nullIfNotEndsWithIgnoreCase

        @NotNull
        T nullIfNotEndsWithIgnoreCase​(CharSequence... matches)
      • nullIfStartsWith

        @NotNull
        T nullIfStartsWith​(boolean ignoreCase,
                           CharSequence... matches)
      • nullIfNotStartsWith

        @NotNull
        T nullIfNotStartsWith​(boolean ignoreCase,
                              CharSequence... matches)
      • nullIfEndsWith

        @NotNull
        T nullIfEndsWith​(boolean ignoreCase,
                         CharSequence... matches)
      • nullIfNotEndsWith

        @NotNull
        T nullIfNotEndsWith​(boolean ignoreCase,
                            CharSequence... matches)
      • eolEndLength

        int eolEndLength()
        Get the length of EOL character at the end of this sequence, if present.

        \n - 1 \r - 1 \r\n - 2

        Returns:
        0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
      • eolStartLength

        @Deprecated
        default int eolStartLength()
        Deprecated.
      • eolEndLength

        int eolEndLength​(int eolEnd)
        Get the length of EOL character at the given index of this sequence, if present.

        \n - 1 \r - 1 \r\n - 2

        Parameters:
        eolEnd - 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.
        Returns:
        0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
      • eolStartLength

        int eolStartLength​(int eolStart)
        Get the length of EOL character at the given index of this sequence, if present.

        \n - 1 \r - 1 \r\n - 2

        Parameters:
        eolStart - 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
        Returns:
        0 if no EOL, 1, or 2 depending on the EOL suffix of this sequence
      • eolLength

        @Deprecated
        default int eolLength​(int eolStart)
        Deprecated.
      • eolEndRange

        @NotNull
        @NotNull Range eolEndRange​(int eolEnd)
        Return Range of eol at given index
        Parameters:
        eolEnd - 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.
        Returns:
        range of eol given by index of its end or Range.NULL if no eol ends at index
      • eolStartRange

        @NotNull
        @NotNull Range eolStartRange​(int eolStart)
        Return Range of eol at given index
        Parameters:
        eolStart - 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
        Returns:
        range of eol given by index of its end or Range.NULL if no eol starts at index
      • trimEOL

        @NotNull
        T trimEOL()
        Trim last eol at the end of this sequence,
        Returns:
        sequence with one EOL trimmed off if it had one
      • trimmedEOL

        @NotNull
        T trimmedEOL()
        Get Trimmed part by trimEOL()
        Returns:
        trimmed off EOL if sequence had one or nullSequence()
      • endOfDelimitedBy

        int endOfDelimitedBy​(@NotNull
                             @NotNull CharSequence s,
                             int 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

        Parameters:
        s - character sequence delimiting the region
        index - from which to start looking for end of region
        Returns:
        index of end of region delimited by s
      • endOfDelimitedByAny

        int endOfDelimitedByAny​(@NotNull
                                @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                                int index)
      • endOfDelimitedByAnyNot

        int endOfDelimitedByAnyNot​(@NotNull
                                   @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                                   int index)
      • startOfDelimitedBy

        int startOfDelimitedBy​(@NotNull
                               @NotNull CharSequence s,
                               int index)
      • startOfDelimitedByAny

        int startOfDelimitedByAny​(@NotNull
                                  @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                                  int index)
      • startOfDelimitedByAnyNot

        int startOfDelimitedByAnyNot​(@NotNull
                                     @NotNull com.vladsch.flexmark.util.misc.CharPredicate s,
                                     int index)
      • endOfLine

        int endOfLine​(int index)
        Get the offset of the end of line at given index, end of line delimited by \n
        Parameters:
        index - index where to start searching for end of line
        Returns:
        index of end of line delimited by \n
      • endOfLineAnyEOL

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

        int startOfLine​(int index)
        Get the offset of the start of line at given index, start of line delimited by \n
        Parameters:
        index - index where to start searching for end of line
        Returns:
        index of end of line delimited by \n
      • startOfLineAnyEOL

        int startOfLineAnyEOL​(int 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.
        Parameters:
        index - index where to start searching for end of line
        Returns:
        index of end of line delimited by \n
      • lineRangeAt

        @NotNull
        @NotNull Range lineRangeAt​(int index)
        Get the line characters at given index, line delimited by \n
        Parameters:
        index - index at which to get the line
        Returns:
        range in sequence for the line delimited by '\n', containing index
      • lineRangeAtAnyEOL

        @NotNull
        @NotNull Range lineRangeAtAnyEOL​(int index)
        Get the line characters at given index, line delimited by \n, \r or \r\n
        Parameters:
        index - index at which to get the line
        Returns:
        range in sequence for the line delimited by end of line, containing index
      • lineAt

        @NotNull
        T lineAt​(int index)
        Get the line characters at given index, line delimited by \n
        Parameters:
        index - index at which to get the line
        Returns:
        sub-sequence for the line containing index
      • lineAtAnyEOL

        @NotNull
        T lineAtAnyEOL​(int index)
        Get the line characters at given index, line delimited by \n, \r or \r\n
        Parameters:
        index - index at which to get the line
        Returns:
        sub-sequence for the line containing index
      • trimTailBlankLines

        @NotNull
        T trimTailBlankLines()
        Trim leading trailing blank lines in this sequence
        Returns:
        return sequence with trailing blank lines trimmed off
      • trimLeadBlankLines

        @NotNull
        T trimLeadBlankLines()
      • leadingBlankLinesRange

        @NotNull
        @NotNull Range leadingBlankLinesRange​(@NotNull
                                              @NotNull com.vladsch.flexmark.util.misc.CharPredicate eolChars,
                                              int fromIndex,
                                              int endIndex)
        Get Range of leading blank lines at given index offsets in sequence
        Parameters:
        eolChars - characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
        fromIndex - 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()
        endIndex - 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()
        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
      • trailingBlankLinesRange

        @NotNull
        @NotNull Range trailingBlankLinesRange​(com.vladsch.flexmark.util.misc.CharPredicate eolChars,
                                               int startIndex,
                                               int fromIndex)
        Get Range of trailing blank lines at given index offsets in sequence
        Parameters:
        eolChars - characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
        startIndex - 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()
        fromIndex - 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()
        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
      • leadingBlankLinesRange

        @NotNull
        @NotNull Range leadingBlankLinesRange()
      • leadingBlankLinesRange

        @NotNull
        @NotNull Range leadingBlankLinesRange​(int startIndex)
      • leadingBlankLinesRange

        @NotNull
        @NotNull Range leadingBlankLinesRange​(int fromIndex,
                                              int endIndex)
      • trailingBlankLinesRange

        @NotNull
        @NotNull Range trailingBlankLinesRange()
      • trailingBlankLinesRange

        @NotNull
        @NotNull Range trailingBlankLinesRange​(int fromIndex)
      • trailingBlankLinesRange

        @NotNull
        @NotNull Range trailingBlankLinesRange​(int startIndex,
                                               int fromIndex)
      • blankLinesRemovedRanges

        @NotNull
        @NotNull List<Range> blankLinesRemovedRanges()
      • blankLinesRemovedRanges

        @NotNull
        @NotNull List<Range> blankLinesRemovedRanges​(int fromIndex)
      • blankLinesRemovedRanges

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

        @NotNull
        @NotNull List<Range> blankLinesRemovedRanges​(@NotNull
                                                     @NotNull com.vladsch.flexmark.util.misc.CharPredicate eolChars,
                                                     int fromIndex,
                                                     int endIndex)
      • trimToEndOfLine

        @NotNull
        T trimToEndOfLine​(@NotNull
                          @NotNull com.vladsch.flexmark.util.misc.CharPredicate eolChars,
                          boolean includeEol,
                          int index)
        Trim end to end of line containing index
        Parameters:
        eolChars - characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
        includeEol - true if EOL is to be included in the line
        index - 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()
        Returns:
        trimmed version of the sequence to given EOL or the original sequence
      • trimToEndOfLine

        @NotNull
        T trimToEndOfLine​(boolean includeEol,
                          int index)
      • trimToEndOfLine

        @NotNull
        T trimToEndOfLine​(boolean includeEol)
      • trimToEndOfLine

        @NotNull
        T trimToEndOfLine​(int index)
      • trimToEndOfLine

        @NotNull
        T trimToEndOfLine()
      • trimToStartOfLine

        @NotNull
        T trimToStartOfLine​(@NotNull
                            @NotNull com.vladsch.flexmark.util.misc.CharPredicate eolChars,
                            boolean includeEol,
                            int index)
        Trim start to start of line containing index
        Parameters:
        eolChars - characters to consider as EOL, note eolStartLength(int) should report length of EOL found if length > 1
        includeEol - true if EOL is to be included in the line
        index - 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()
        Returns:
        trimmed version of the sequence to given EOL or the original sequence
      • trimToStartOfLine

        @NotNull
        T trimToStartOfLine​(boolean includeEol,
                            int index)
      • trimToStartOfLine

        @NotNull
        T trimToStartOfLine​(boolean includeEol)
      • trimToStartOfLine

        @NotNull
        T trimToStartOfLine​(int index)
      • trimToStartOfLine

        @NotNull
        T trimToStartOfLine()
      • normalizeEOL

        @NotNull
        @NotNull String normalizeEOL()
        replace any \r\n and \r by \n
        Returns:
        string with only \n for line separators
      • normalizeEndWithEOL

        @NotNull
        @NotNull String normalizeEndWithEOL()
        replace any \r\n and \r by \n, append terminating EOL if one is not present
        Returns:
        string with only \n for line separators and terminated by \n
      • matches

        boolean matches​(@NotNull
                        @NotNull CharSequence chars)
        Test the sequence for a match to another CharSequence
        Parameters:
        chars - characters to match against
        Returns:
        true if match
      • matchesIgnoreCase

        boolean matchesIgnoreCase​(@NotNull
                                  @NotNull CharSequence chars)
      • matches

        boolean matches​(@NotNull
                        @NotNull CharSequence chars,
                        boolean ignoreCase)
      • equalsIgnoreCase

        boolean equalsIgnoreCase​(@Nullable
                                 @Nullable Object other)
        Test the sequence for a match to another CharSequence, ignoring case differences
        Parameters:
        other - characters to match against
        Returns:
        true if match
      • equals

        boolean equals​(@Nullable
                       @Nullable Object other,
                       boolean ignoreCase)
        Test the sequence for a match to another CharSequence
        Parameters:
        other - characters to match against
        ignoreCase - case ignored when true
        Returns:
        true if match
      • matchChars

        boolean matchChars​(@NotNull
                           @NotNull CharSequence chars)
        Test the sequence portion for a match to another CharSequence
        Parameters:
        chars - characters to match against
        Returns:
        true if characters at the start of this sequence match
      • matchCharsIgnoreCase

        boolean matchCharsIgnoreCase​(@NotNull
                                     @NotNull CharSequence chars)
      • matchChars

        boolean matchChars​(@NotNull
                           @NotNull CharSequence chars,
                           boolean ignoreCase)
      • matchChars

        boolean matchChars​(@NotNull
                           @NotNull CharSequence chars,
                           int startIndex,
                           boolean ignoreCase)
        Test the sequence portion for a match to another CharSequence
        Parameters:
        chars - characters to match against
        startIndex - index from which to start the match
        ignoreCase - if true match ignoring case differences
        Returns:
        true if characters at the start index of this sequence match
      • matchChars

        boolean matchChars​(@NotNull
                           @NotNull CharSequence chars,
                           int startIndex)
      • matchCharsIgnoreCase

        boolean matchCharsIgnoreCase​(@NotNull
                                     @NotNull CharSequence chars,
                                     int startIndex)
      • matchedCharCount

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

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

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

        int matchedCharCount​(@NotNull
                             @NotNull CharSequence chars,
                             int startIndex,
                             int endIndex)
      • matchedCharCount

        int matchedCharCount​(@NotNull
                             @NotNull CharSequence chars,
                             int startIndex)
      • matchedCharCountIgnoreCase

        int matchedCharCountIgnoreCase​(@NotNull
                                       @NotNull CharSequence chars,
                                       int startIndex,
                                       int endIndex)
      • matchedCharCountIgnoreCase

        int matchedCharCountIgnoreCase​(@NotNull
                                       @NotNull CharSequence chars,
                                       int startIndex)
      • matchCharsReversed

        boolean matchCharsReversed​(@NotNull
                                   @NotNull CharSequence chars,
                                   int endIndex,
                                   boolean ignoreCase)
        Test the sequence portion for a match to another CharSequence, reverse order
        Parameters:
        chars - characters to match against
        endIndex - index from which to start the match and proceed to 0
        ignoreCase - if true match ignoring case differences
        Returns:
        true if characters at the start index of this sequence match
      • matchCharsReversed

        boolean matchCharsReversed​(@NotNull
                                   @NotNull CharSequence chars,
                                   int endIndex)
      • matchCharsReversedIgnoreCase

        boolean matchCharsReversedIgnoreCase​(@NotNull
                                             @NotNull CharSequence chars,
                                             int endIndex)
      • matchedCharCountReversed

        int matchedCharCountReversed​(@NotNull
                                     @NotNull CharSequence chars,
                                     int startIndex,
                                     int fromIndex,
                                     boolean 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
        Parameters:
        chars - characters to match against
        startIndex - index at which to stop the match
        fromIndex - index from which to start the match, not inclusive, matching starts at fromIndex-1 and proceeds towards 0
        ignoreCase - if true match ignoring case differences
        Returns:
        count of characters at the from index of this sequence matching corresponding characters in chars in reverse order
      • matchedCharCountReversed

        int matchedCharCountReversed​(@NotNull
                                     @NotNull CharSequence chars,
                                     int startIndex,
                                     int fromIndex)
      • matchedCharCountReversedIgnoreCase

        int matchedCharCountReversedIgnoreCase​(@NotNull
                                               @NotNull CharSequence chars,
                                               int startIndex,
                                               int fromIndex)
      • matchedCharCountReversed

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

        int matchedCharCountReversed​(@NotNull
                                     @NotNull CharSequence chars,
                                     int fromIndex)
      • matchedCharCountReversedIgnoreCase

        int matchedCharCountReversedIgnoreCase​(@NotNull
                                               @NotNull CharSequence chars,
                                               int fromIndex)
      • endsWith

        boolean endsWith​(@NotNull
                         @NotNull CharSequence suffix)
        test if this sequence ends with given characters
        Parameters:
        suffix - characters to test
        Returns:
        true if ends with suffix
      • endsWith

        boolean endsWith​(@NotNull
                         @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • endsWithEOL

        boolean endsWithEOL()
      • endsWithAnyEOL

        boolean endsWithAnyEOL()
      • endsWithSpace

        boolean endsWithSpace()
      • endsWithSpaceTab

        boolean endsWithSpaceTab()
      • endsWithWhitespace

        boolean endsWithWhitespace()
      • endsWithIgnoreCase

        boolean endsWithIgnoreCase​(@NotNull
                                   @NotNull CharSequence suffix)
        test if this sequence ends with given characters, ignoring case differences
        Parameters:
        suffix - characters to test
        Returns:
        true if ends with suffix
      • endsWith

        boolean endsWith​(@NotNull
                         @NotNull CharSequence suffix,
                         boolean ignoreCase)
        test if this sequence ends with given characters
        Parameters:
        suffix - characters to test
        ignoreCase - case ignored when true
        Returns:
        true if ends with suffix
      • startsWith

        boolean startsWith​(@NotNull
                           @NotNull CharSequence prefix)
        test if this sequence starts with given characters
        Parameters:
        prefix - characters to test
        Returns:
        true if starts with prefix
      • startsWith

        boolean startsWith​(@NotNull
                           @NotNull com.vladsch.flexmark.util.misc.CharPredicate chars)
      • startsWithEOL

        boolean startsWithEOL()
      • startsWithAnyEOL

        boolean startsWithAnyEOL()
      • startsWithSpace

        boolean startsWithSpace()
      • startsWithSpaceTab

        boolean startsWithSpaceTab()
      • startsWithWhitespace

        boolean startsWithWhitespace()
      • startsWithIgnoreCase

        boolean startsWithIgnoreCase​(@NotNull
                                     @NotNull CharSequence prefix)
        test if this sequence starts with given characters, ignoring case differences
        Parameters:
        prefix - characters to test
        Returns:
        true if starts with prefix
      • startsWith

        boolean startsWith​(@NotNull
                           @NotNull CharSequence prefix,
                           boolean ignoreCase)
        test if this sequence starts with given characters
        Parameters:
        prefix - characters to test
        ignoreCase - case ignored when true
        Returns:
        true if starts with prefix
      • removeSuffix

        @NotNull
        T removeSuffix​(@NotNull
                       @NotNull CharSequence suffix)
        Remove suffix if present
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeSuffixIgnoreCase

        @NotNull
        T removeSuffixIgnoreCase​(@NotNull
                                 @NotNull CharSequence suffix)
        Remove suffix if present, ignoring case differences
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeSuffix

        @NotNull
        T removeSuffix​(@NotNull
                       @NotNull CharSequence suffix,
                       boolean ignoreCase)
        Remove suffix if present
        Parameters:
        suffix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removePrefix

        @NotNull
        T removePrefix​(@NotNull
                       @NotNull CharSequence prefix)
        Remove prefix if present
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removePrefixIgnoreCase

        @NotNull
        T removePrefixIgnoreCase​(@NotNull
                                 @NotNull CharSequence prefix)
        Remove prefix if present, ignoring case differences
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removePrefix

        @NotNull
        T removePrefix​(@NotNull
                       @NotNull CharSequence prefix,
                       boolean ignoreCase)
        Remove prefix if present
        Parameters:
        prefix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removeProperSuffix

        @NotNull
        T removeProperSuffix​(@NotNull
                             @NotNull CharSequence suffix)
        Remove suffix if present but only if this sequence is longer than the suffix
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeProperSuffixIgnoreCase

        @NotNull
        T removeProperSuffixIgnoreCase​(@NotNull
                                       @NotNull CharSequence suffix)
        Remove suffix if present but only if this sequence is longer than the suffix, ignoring case differences
        Parameters:
        suffix - characters to remove
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeProperSuffix

        @NotNull
        T removeProperSuffix​(@NotNull
                             @NotNull CharSequence suffix,
                             boolean ignoreCase)
        Remove suffix if present but only if this sequence is longer than the suffix
        Parameters:
        suffix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with suffix removed, or same sequence if no suffix was present
      • removeProperPrefix

        @NotNull
        T removeProperPrefix​(@NotNull
                             @NotNull CharSequence prefix)
        Remove prefix if present but only if this sequence is longer than the suffix
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removeProperPrefixIgnoreCase

        @NotNull
        T removeProperPrefixIgnoreCase​(@NotNull
                                       @NotNull CharSequence prefix)
        Remove prefix if present but only if this sequence is longer than the suffix, ignoring case differences
        Parameters:
        prefix - characters to remove
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • removeProperPrefix

        @NotNull
        T removeProperPrefix​(@NotNull
                             @NotNull CharSequence prefix,
                             boolean ignoreCase)
        Remove prefix if present but only if this sequence is longer than the suffix
        Parameters:
        prefix - characters to remove
        ignoreCase - case ignored when true
        Returns:
        sequence with prefix removed, or same sequence if no prefix was present
      • insert

        @NotNull
        T insert​(int index,
                 @NotNull
                 @NotNull CharSequence chars)
        Insert char sequence at given index
        Parameters:
        index - index of insertion. if >length of this sequence then same as length, if <0 then same as 0
        chars - char sequence to insert
        Returns:
        resulting sequence based sequence implementation may throw an IllegalArgumentException if inserting another based sequence out of order based on offsets
      • delete

        @NotNull
        T delete​(int startIndex,
                 int endIndex)
        Delete range in sequence
        Parameters:
        startIndex - start index of deletion
        endIndex - end index, not inclusive, of insertion
        Returns:
        resulting sequence
      • replace

        @NotNull
        T replace​(int startIndex,
                  int endIndex,
                  @NotNull
                  @NotNull CharSequence replacement)
        Replace part of the sequence with a char sequence
        Parameters:
        startIndex - start index of replaced part
        endIndex - end index of replaced part
        replacement - char sequence
        Returns:
        resulting sequence
      • replace

        @NotNull
        T replace​(@NotNull
                  @NotNull CharSequence find,
                  @NotNull
                  @NotNull CharSequence replace)
        Replace all occurrences of one sequence with another
        Parameters:
        find - sequence to find
        replace - replacement sequence
        Returns:
        array of indices
      • toLowerCase

        @NotNull
        T toLowerCase()
        Map characters of this sequence to: Uppercase, Lowercase or use custom mapping
        Returns:
        lowercase version of sequence
      • toUpperCase

        @NotNull
        T toUpperCase()
      • toNbSp

        @NotNull
        T toNbSp()
        Map spaces to non break spaces
        Returns:
        mapped sequence with spc changed to NbSp
      • toSpc

        @NotNull
        T toSpc()
        Map non break spaces to spaces
        Returns:
        mapped sequence with NbSp changed to spc
      • toVisibleWhitespaceString

        @NotNull
        @NotNull String toVisibleWhitespaceString()
      • splitList

        @NotNull
        @NotNull List<T> splitList​(@NotNull
                                   @NotNull CharSequence delimiter,
                                   int limit,
                                   int flags,
                                   @Nullable
                                   @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimChars)
        Split helpers based on delimiter character sets contained in CharSequence
        Parameters:
        delimiter - delimiter char sequence to use for splitting
        limit - max number of segments to split
        flags - 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
        trimChars - set of characters that should be used for trimming individual split results
        Returns:
        List of split results
      • splitList

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

        @NotNull
        @NotNull List<T> splitList​(@NotNull
                                   @NotNull CharSequence delimiter)
      • split

        @NotNull
        @NotNull T[] split​(@NotNull
                           @NotNull CharSequence delimiter,
                           int limit,
                           int flags,
                           @Nullable
                           @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimChars)
      • split

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

        @NotNull
        @NotNull T[] split​(@NotNull
                           @NotNull CharSequence delimiter)
      • split

        @Deprecated
        @NotNull
        default @NotNull T[] split​(char delimiter,
                                   int limit,
                                   int flags)
        Deprecated.
      • split

        @Deprecated
        @NotNull
        default @NotNull T[] split​(char delimiter,
                                   int limit)
        Deprecated.
      • split

        @Deprecated
        @NotNull
        default @NotNull T[] split​(char delimiter)
        Deprecated.
      • splitList

        @NotNull
        @NotNull List<T> splitList​(@NotNull
                                   @NotNull CharSequence delimiter,
                                   int limit,
                                   boolean includeDelims,
                                   @Nullable
                                   @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimChars)
        Split helpers based on delimiter character sets contained in CharPredicate
        Parameters:
        delimiter - sequence of chars on which to split this sequence
        limit - max number of segments to split
        includeDelims - if true include delimiters as part of split item
        trimChars - set of characters that should be used for trimming individual split results
        Returns:
        List of split results
      • splitList

        @NotNull
        @NotNull List<T> splitList​(@NotNull
                                   @NotNull CharSequence delimiter,
                                   boolean includeDelims,
                                   @Nullable
                                   @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimChars)
      • split

        @NotNull
        @NotNull T[] split​(@NotNull
                           @NotNull CharSequence delimiter,
                           int limit,
                           boolean includeDelims,
                           @Nullable
                           @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimChars)
      • split

        @NotNull
        @NotNull T[] split​(@NotNull
                           @NotNull CharSequence delimiter,
                           boolean includeDelims,
                           @Nullable
                           @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimChars)
      • splitEOL

        @NotNull
        @NotNull T[] splitEOL()
      • splitEOL

        @NotNull
        @NotNull T[] splitEOL​(boolean includeDelims)
      • splitListEOL

        @NotNull
        @NotNull List<T> splitListEOL()
      • splitListEOL

        @NotNull
        @NotNull List<T> splitListEOL​(boolean includeDelims)
      • splitListEOL

        @NotNull
        @NotNull List<T> splitListEOL​(boolean includeDelims,
                                      @Nullable
                                      @Nullable com.vladsch.flexmark.util.misc.CharPredicate trimChars)
      • indexOfAll

        @NotNull
        @org.jetbrains.annotations.NotNull int[] indexOfAll​(@NotNull
                                                            @NotNull CharSequence s)
        Get indices of all occurrences of a sequence
        Parameters:
        s - sequence whose indices to find
        Returns:
        array of indices
      • prefixWith

        @NotNull
        T prefixWith​(@Nullable
                     @Nullable CharSequence prefix)
        Prefix this sequence with a char sequence
        Parameters:
        prefix - char sequence
        Returns:
        resulting sequence
      • suffixWith

        @NotNull
        T suffixWith​(@Nullable
                     @Nullable CharSequence suffix)
        Prefix this sequence with a char sequence
        Parameters:
        suffix - char sequence
        Returns:
        resulting sequence
      • prefixOnceWith

        @NotNull
        T prefixOnceWith​(@Nullable
                         @Nullable CharSequence prefix)
        Prefix this sequence with a char sequence if not already starting with prefix
        Parameters:
        prefix - char sequence
        Returns:
        resulting sequence
      • suffixOnceWith

        @NotNull
        T suffixOnceWith​(@Nullable
                         @Nullable CharSequence suffix)
        Suffix this sequence with a char sequence if not already ending with suffix
        Parameters:
        suffix - char sequence
        Returns:
        resulting sequence
      • appendEOL

        @NotNull
        T appendEOL()
      • suffixWithEOL

        @NotNull
        T suffixWithEOL()
      • prefixWithEOL

        @NotNull
        T prefixWithEOL()
      • prefixOnceWithEOL

        @NotNull
        T prefixOnceWithEOL()
      • suffixOnceWithEOL

        @NotNull
        T suffixOnceWithEOL()
      • appendSpace

        @NotNull
        T appendSpace()
      • suffixWithSpace

        @NotNull
        T suffixWithSpace()
      • prefixWithSpace

        @NotNull
        T prefixWithSpace()
      • appendSpaces

        @NotNull
        T appendSpaces​(int count)
      • suffixWithSpaces

        @NotNull
        T suffixWithSpaces​(int count)
      • prefixWithSpaces

        @NotNull
        T prefixWithSpaces​(int count)
      • prefixOnceWithSpace

        @NotNull
        T prefixOnceWithSpace()
      • suffixOnceWithSpace

        @NotNull
        T suffixOnceWithSpace()
      • appendTo

        @NotNull
        T appendTo​(@NotNull
                   @NotNull StringBuilder out,
                   @Nullable
                   @Nullable CharMapper charMapper,
                   int startIndex,
                   int endIndex)
        Append helpers
        Parameters:
        out - string builder
        startIndex - start index
        endIndex - end index
        charMapper - mapping to use for output or null if none
        Returns:
        this
      • appendTo

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

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

        @NotNull
        T appendTo​(@NotNull
                   @NotNull StringBuilder out)
      • appendTo

        @NotNull
        T appendTo​(@NotNull
                   @NotNull StringBuilder out,
                   int startIndex)
      • appendRangesTo

        @NotNull
        T appendRangesTo​(@NotNull
                         @NotNull StringBuilder out,
                         @Nullable
                         @Nullable CharMapper charMapper,
                         Range... ranges)
        Append given ranges of this sequence to string builder
        Parameters:
        out - string builder to append to
        charMapper - mapping to use for output or null if none
        ranges - ranges to append, null range or one for which range.isNull() is true ranges are skipped
        Returns:
        this
      • appendRangesTo

        @NotNull
        T appendRangesTo​(@NotNull
                         @NotNull StringBuilder out,
                         Range... ranges)
      • extractRanges

        @NotNull
        T extractRanges​(Range... 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

        Parameters:
        ranges - ranges to extract
        Returns:
        resulting sequence
      • append

        @NotNull
        T append​(CharSequence... sequences)
        Concatenate this sequence and list of others, returning sequence of result
        Parameters:
        sequences - list of char sequences to append to this sequence, null sequences are skipped
        Returns:
        appended sequence
      • lineColumnAtIndex

        @NotNull
        @NotNull com.vladsch.flexmark.util.misc.Pair<Integer,​Integer> lineColumnAtIndex​(int index)
        Get the line and column information from index into sequence
        Parameters:
        index - index for which to get line information
        Returns:
        Pair(line, column) where line and column are 0 based, throws IllegalArgumentException if index < 0 or > length.
      • getLineColumnAtIndex

        @Deprecated
        @NotNull
        default @NotNull com.vladsch.flexmark.util.misc.Pair<Integer,​Integer> getLineColumnAtIndex​(int index)
        Deprecated.
      • columnAtIndex

        int columnAtIndex​(int index)
      • getColumnAtIndex

        @Deprecated
        default int getColumnAtIndex​(int index)
        Deprecated.
      • isCharAt

        boolean isCharAt​(int index,
                         @NotNull
                         @NotNull com.vladsch.flexmark.util.misc.CharPredicate predicate)
        Safe, if index out of range returns '\0'
        Parameters:
        index - index in string
        predicate - character set predicate
        Returns:
        true if character at index tests true
      • toStringOrNull

        @Nullable
        @Nullable String toStringOrNull()
        Return string or null if BaseSequence.NULL
        Returns:
        string or null if BaseSequence.NULL
      • isIn

        boolean isIn​(@NotNull
                     @NotNull String[] texts)