public class StringView extends UnicodeString
| Modifier and Type | Method and Description |
|---|---|
int |
codePointAt(long index)
Get the code point at a given position in the string
|
IntIterator |
codePoints()
Get an iterator over the code points present in the string.
|
int |
compareTo(UnicodeString other)
Compare this string to another using codepoint comparison
|
UnicodeString |
concat(UnicodeString other)
Concatenate with another string, returning a new string
|
UnicodeString |
economize() |
boolean |
equals(java.lang.Object obj) |
long |
estimatedLength()
Get the estimated length of the string, suitable for space allocation.
|
int |
getWidth()
Get the number of bits needed to hold all the characters in this string
|
int |
hashCode()
Compute a hashCode.
|
long |
indexOf(int codePoint,
long from)
Get the position of the first occurrence of the specified codepoint,
starting the search at a given position in the string
|
boolean |
isEmpty()
Ask whether the string is empty
|
long |
length()
Get the length of the string
|
static UnicodeString |
of(java.lang.String base) |
UnicodeString |
substring(long start,
long end)
Get a substring of this codepoint sequence, with a given start and end position
|
UnicodeString |
tidy()
Ensure that the implementation is capable of counting codepoints in the string.
|
static UnicodeString |
tidy(java.lang.String base) |
java.lang.String |
toString() |
static UnicodeString |
wrap(java.lang.String base) |
asAtomic, checkSubstringBounds, hasSubstring, indexOf, indexOf, indexWhere, length32, prefix, requireInt, substring, verifyCharacterspublic static UnicodeString of(java.lang.String base)
public static UnicodeString wrap(java.lang.String base)
public static UnicodeString tidy(java.lang.String base)
public UnicodeString tidy()
UnicodeStringtidy in class UnicodeStringUnicodeString, or another that represents the same sequence
of characters.public boolean isEmpty()
UnicodeStringisEmpty in class UnicodeStringpublic long estimatedLength()
UnicodeStringestimatedLength in class UnicodeStringUnicodeString, the actual length of the string in codepointspublic long length()
length in class UnicodeStringpublic int getWidth()
getWidth in class UnicodeStringpublic long indexOf(int codePoint,
long from)
indexOf in class UnicodeStringcodePoint - the sought codepointfrom - the position from which the search should start (0-based). There
is no restriction on the value. Negative values are treated as zero;
values greater than or equal to length() return -1.public int codePointAt(long index)
codePointAt in class UnicodeStringindex - the given position (0-based)java.lang.IndexOutOfBoundsException - if the index is out of rangepublic UnicodeString substring(long start, long end)
substring in class UnicodeStringstart - the start position (0-based): that is, the position of the first
code point to be includedend - the end position (0-based): specifically, the position of the first
code point not to be includedjava.lang.UnsupportedOperationException - if the UnicodeString has not been prepared
for codePoint accesspublic IntIterator codePoints()
UnicodeStringcodePoints in class UnicodeStringpublic UnicodeString concat(UnicodeString other)
UnicodeStringconcat in class UnicodeStringother - the string to be appendedpublic int compareTo(UnicodeString other)
UnicodeStringcompareTo in interface java.lang.Comparable<UnicodeString>compareTo in class UnicodeStringother - the other stringpublic boolean equals(java.lang.Object obj)
equals in class UnicodeStringpublic int hashCode()
UnicodeStringUnicodeString use compatible hash codes and the
hashing algorithm is therefore identical to that for java.lang.String. This means
that for strings containing Astral characters, the hash code needs to be computed by decomposing
an Astral character into a surrogate pair.hashCode in class UnicodeStringpublic UnicodeString economize()
economize in class UnicodeStringpublic java.lang.String toString()
toString in class java.lang.ObjectCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.