public final class BMPString extends UnicodeString
EMPTY_STRING
Constructor and Description |
---|
BMPString(CharSequence src)
Create a BMPString
|
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index)
Returns the
char value at the specified index. |
CharSequence |
getCharSequence()
Get the underlying CharSequence
|
boolean |
isEnd(int pos)
Ask whether a given position is at (or beyond) the end of the string
|
int |
length()
Returns the length of this character sequence.
|
CharSequence |
subSequence(int start,
int end)
Returns a new
CharSequence that is a subsequence of this sequence. |
String |
toString() |
int |
uCharAt(int pos)
Get the character at a specified position
|
int |
uIndexOf(int search,
int pos)
Get the first match for a given character
|
int |
uLength()
Get the length of the string, in Unicode codepoints
|
UnicodeString |
uSubstring(int beginIndex,
int endIndex)
Get a substring of this string
|
compareTo, containsSurrogatePairs, equals, getMaxWidth, hashCode, makeUnicodeString, makeUnicodeString
public BMPString(CharSequence src)
src
- - encapsulated CharSequence.
The client must ensure that this contains no surrogate pairs, and that
it is immutablepublic UnicodeString uSubstring(int beginIndex, int endIndex)
UnicodeString
uSubstring
in class UnicodeString
beginIndex
- the index of the first character to be included (counting
codepoints, not 16-bit characters)endIndex
- the index of the first character to be NOT included (counting
codepoints, not 16-bit characters)public int uCharAt(int pos)
UnicodeString
uCharAt
in class UnicodeString
pos
- the index of the required character (counting
codepoints, not 16-bit characters)public int uIndexOf(int search, int pos)
UnicodeString
uIndexOf
in class UnicodeString
search
- the character to look forpos
- the first position to lookpublic int uLength()
UnicodeString
uLength
in class UnicodeString
public boolean isEnd(int pos)
UnicodeString
isEnd
in class UnicodeString
pos
- the index of the required character (counting
codepoints, not 16-bit characters)public String toString()
toString
in interface CharSequence
toString
in class Object
public CharSequence getCharSequence()
public int length()
char
s in the sequence.char
s in this sequencepublic char charAt(int index)
char
value at the specified index. An index ranges from zero
to length() - 1. The first char
value of the sequence is at
index zero, the next at index one, and so on, as for array
indexing.
If the char
value specified by the index is a
surrogate, the surrogate
value is returned.
index
- the index of the char
value to be returnedchar
valueIndexOutOfBoundsException
- if the index argument is negative or not less than
length()public CharSequence subSequence(int start, int end)
CharSequence
that is a subsequence of this sequence.
The subsequence starts with the char
value at the specified index and
ends with the char
value at index end - 1. The length
(in char
s) of the
returned sequence is end - start, so if start == end
then an empty sequence is returned. start
- the start index, inclusiveend
- the end index, exclusiveIndexOutOfBoundsException
- if start or end are negative,
if end is greater than length(),
or if start is greater than endCopyright (c) 2004-2014 Saxonica Limited. All rights reserved.