public class Slice16 extends UnicodeString
| Constructor and Description |
|---|
Slice16(char[] chars,
int start,
int end)
Create a slice of an underlying char array
|
| 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.
|
char[] |
getCharArray() |
int |
getEnd() |
int |
getStart() |
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
|
long |
indexWhere(java.util.function.IntPredicate predicate,
long from)
Get the position of the first occurrence of the specified codepoint,
starting the search at a given position in the string
|
long |
length()
Get the length of the string
|
UnicodeString |
substring(long start,
long end)
Get a substring of this string, with a given start and end position
|
java.lang.String |
toString()
Convert to a string.
|
asAtomic, checkSubstringBounds, compareTo, concat, economize, equals, estimatedLength, hasSubstring, indexOf, indexOf, isEmpty, length32, prefix, requireInt, substring, tidy, verifyCharacterspublic Slice16(char[] chars,
int start,
int end)
chars - the char array, containing Unicode codepoints in the range 0-65535;
the caller warrants that there are no surrogate characters presentstart - the offset of the first character within the character arrayend - the offset of the first excluded character, so the length of the string
is end-startpublic long length()
UnicodeStringlength in class UnicodeStringpublic int getWidth()
UnicodeStringgetWidth in class UnicodeStringpublic char[] getCharArray()
public int getStart()
public int getEnd()
public long indexOf(int codePoint,
long from)
UnicodeStringindexOf in class UnicodeStringcodePoint - the sought codePointfrom - the position from which the search should start (0-based)public int codePointAt(long index)
UnicodeStringcodePointAt in class UnicodeStringindex - the given position (0-based)public UnicodeString substring(long start, long end)
UnicodeStringsubstring 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 includedpublic long indexWhere(java.util.function.IntPredicate predicate,
long from)
indexWhere in class UnicodeStringpredicate - condition that the codepoint must satisfyfrom - the position from which the search should start (0-based)java.lang.UnsupportedOperationException - if the UnicodeString has not been prepared
for codePoint accesspublic IntIterator codePoints()
UnicodeStringcodePoints in class UnicodeStringpublic int hashCode()
UnicodeString 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 java.lang.String toString()
toString in class java.lang.ObjectCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.