public class Slice24 extends UnicodeString
Constructor and Description |
---|
Slice24(byte[] bytes,
int start,
int end)
Create a slice of an underlying byte 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.
|
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()
Display as a string.
|
asAtomic, checkSubstringBounds, compareTo, concat, economize, equals, estimatedLength, hasSubstring, indexOf, indexOf, isEmpty, length32, prefix, requireInt, substring, tidy, verifyCharacters
public Slice24(byte[] bytes, int start, int end)
bytes
- the byte array, containing Unicode codepoints in the range 0-255start
- the codepoint offset of the first character within the byte arrayend
- the codepoint offset of the first excluded character, so the length of the string
is end-start
public long length()
UnicodeString
length
in class UnicodeString
public int getWidth()
UnicodeString
getWidth
in class UnicodeString
public long indexOf(int codePoint, long from)
UnicodeString
indexOf
in class UnicodeString
codePoint
- the sought codePointfrom
- the position from which the search should start (0-based)public long indexWhere(java.util.function.IntPredicate predicate, long from)
indexWhere
in class UnicodeString
predicate
- 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 int codePointAt(long index)
UnicodeString
codePointAt
in class UnicodeString
index
- the given position (0-based)public UnicodeString substring(long start, long end)
UnicodeString
substring
in class UnicodeString
start
- 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 IntIterator codePoints()
UnicodeString
codePoints
in class UnicodeString
public 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 UnicodeString
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2004-2022 Saxonica Limited. All rights reserved.