public class SubSequence extends Object implements CharSequence
CharSequence
which is a by-reference subsequence of another
CharSequence
. This is particularly useful for
regex
matching without excessive string
copying.
Surprisingly, core Java does not seem to have this capability (apart from
Segment
, which seems misplaced in the Swing
library); all of String.subSequence(int, int)
, StringBuffer.subSequence(int, int)
and StringBuilder.subSequence(int, int)
internally copy the requested string
segment.
Constructor and Description |
---|
SubSequence(CharSequence seq,
int offset) |
SubSequence(CharSequence seq,
int offset,
int length) |
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index) |
int |
length() |
SubSequence |
subSequence(int start,
int end) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
chars, codePoints
public SubSequence(CharSequence seq, int offset)
public SubSequence(CharSequence seq, int offset, int length)
public int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public SubSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public String toString()
toString
in interface CharSequence
toString
in class Object
Copyright © 2015–2022 SciJava. All rights reserved.