Package snap.util
Interface CharSequenceX
- All Superinterfaces:
CharSequence
- All Known Implementing Classes:
CharBlock
,CharLine
,TextBlock
,TextBox
,TextDoc
,TextLine
,TextRun
,TokenLine
This CharSequence sub interface adds some convenience methods.
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
Returns length of leading whitespace chars.default String
Returns a string of any leading whitespace chars.default char
Returns the last char.default int
indexAfterNewline
(int aStart) Returns index just beyond next newline (or carriage-return/newline) starting at given char index.default int
indexAfterNewlineOrEnd
(int aStart) Returns index just beyond next newline (or carriage-return/newline) starting at given char index or chars end if no newline.default int
indexOfNewline
(int aStart) Returns index of next newline (or carriage-return/newline) starting at given char index.default boolean
isAfterLineEnd
(int anIndex) Returns whether the index in the given char sequence is at just after a line end.default boolean
Returns whether run ends with newline.default boolean
isLineEnd
(int anIndex) Returns whether the index in the given char sequence is at a line end.default boolean
isLineEndChar
(int anIndex) Returns whether a char is a newline char.default boolean
Returns whether this sequence is just whitespace.default int
lastIndexAfterNewline
(int aStart) Returns index just beyond previous newline (or carriage-return/newline) starting at given char index.default int
lastIndexOfNewline
(int aStart) Returns index of the previous newline (or carriage-return/newline) starting at given char index.default boolean
startsWith
(String aString) Returns whether sequence starts with given string.Methods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, isEmpty, length, subSequence, toString
-
Method Details
-
getLastChar
default char getLastChar()Returns the last char. -
isLastCharNewline
default boolean isLastCharNewline()Returns whether run ends with newline. -
indexOfNewline
default int indexOfNewline(int aStart) Returns index of next newline (or carriage-return/newline) starting at given char index. -
indexAfterNewline
default int indexAfterNewline(int aStart) Returns index just beyond next newline (or carriage-return/newline) starting at given char index. -
indexAfterNewlineOrEnd
default int indexAfterNewlineOrEnd(int aStart) Returns index just beyond next newline (or carriage-return/newline) starting at given char index or chars end if no newline. -
lastIndexOfNewline
default int lastIndexOfNewline(int aStart) Returns index of the previous newline (or carriage-return/newline) starting at given char index. -
lastIndexAfterNewline
default int lastIndexAfterNewline(int aStart) Returns index just beyond previous newline (or carriage-return/newline) starting at given char index. -
isLineEnd
default boolean isLineEnd(int anIndex) Returns whether the index in the given char sequence is at a line end. -
isAfterLineEnd
default boolean isAfterLineEnd(int anIndex) Returns whether the index in the given char sequence is at just after a line end. -
isLineEndChar
default boolean isLineEndChar(int anIndex) Returns whether a char is a newline char. -
startsWith
Returns whether sequence starts with given string. -
getIndentLength
default int getIndentLength()Returns length of leading whitespace chars. -
getIndentString
Returns a string of any leading whitespace chars. -
isWhiteSpace
default boolean isWhiteSpace()Returns whether this sequence is just whitespace.
-