public class BMPString extends UnicodeString
UnicodeString that wraps a Java string which is known to contain
no surrogates. That is, all the characters in the string are in the Basic Multilingual
Plane (their codepoints are in the range 0-65535).| Modifier | Constructor and Description |
|---|---|
protected |
BMPString(java.lang.String baseString)
Protected constructor
|
| 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
|
boolean |
equals(java.lang.Object obj) |
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)
Get the position of the first occurrence of the specified codepoint,
starting the search at the beginning
|
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
|
boolean |
isEmpty()
Ask whether the string is empty
|
long |
length()
Get the length of the string
|
static UnicodeString |
of(java.lang.String base)
Wrap a String, which must contain no surrogates
|
UnicodeString |
substring(long start,
long end)
Get a substring of this string, with a given start and end position
|
java.lang.String |
toString() |
asAtomic, checkSubstringBounds, economize, estimatedLength, hasSubstring, indexOf, length32, prefix, requireInt, substring, tidy, verifyCharactersprotected BMPString(java.lang.String baseString)
baseString - the string to be wrapped: the caller is responsible for ensuring this
contains no surrogatespublic static UnicodeString of(java.lang.String base)
base - the string. The caller warrants that this string contains no surrogates;
this condition is checked only if Java assertions are enabled.public long length()
UnicodeStringlength in class UnicodeStringpublic boolean isEmpty()
UnicodeStringisEmpty in class UnicodeStringpublic int getWidth()
UnicodeStringgetWidth in class UnicodeStringpublic IntIterator codePoints()
UnicodeStringcodePoints in class UnicodeStringpublic long indexOf(int codePoint)
UnicodeStringindexOf in class UnicodeStringcodePoint - the sought codePointpublic long indexOf(int codePoint,
long from)
UnicodeStringindexOf in class UnicodeStringcodePoint - 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 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 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 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 java.lang.String toString()
toString in class java.lang.ObjectCopyright (c) 2004-2022 Saxonica Limited. All rights reserved.