Interface StringUTF
access this type via: encoding.StringUTF (provides, requires or uses)
Unicode string encoding support (UTF-8 by default). Unicode formats use multi-byte character encoding of various lengths per character.
Functions
StringUTF(char input[])
char[] charAt(int i)
void setCharAt(int i, char ch[])
int4 charCode(char c[])
char[] codeChar(int4 c)
int length()
char[] subString(int start, int length)
void replace(int start, int length, char with[])
void delete(int start, int length)
void insert(int index, char txt[])
void append(char txt[])
char[] getRaw()
int rawIndex(int charIndex)
int charIndex(int rawIndex)
int4[] getCodepoints()
void setCodepoints(int4 points[])
StringUTF(char input[])
Construct a new UTF-encoded string, from raw encoded data.
char[] charAt(int i)
Get the character at the given index.
i The index into the string.
returns: The encoded character, which may be more than one byte.
void setCharAt(int i, char ch[])
Set the character at the given index.
i The index into the string.
ch The encoded character, which may be more than one byte.
int4 charCode(char c[])
Get the unicode codepoint of the given encoded raw character bytes.
c The encoded character bytes.
returns: The unicode codepoint.
char[] codeChar(int4 c)
Get the encoded character bytes for the given unicode codepoint.
c The unicode codepoint.
returns: The encoded character bytes.
int length()
Get the length of the unicode string, in unicode characters.
char[] subString(int start, int length)
Get a sub-string, with the start and length specified in unicode characters.
returns: The raw encoded character bytes of the sub-string.
void replace(int start, int length, char with[])
Replace a region of the string with a different string (which can be a different length.
start The starting character index of the region to replace (in unicode characters).
length The length of the region to replace (in unicode characters).
with The raw encoded characters to use as the replacement.
void delete(int start, int length)
Delete a region of the string.
start The starting character index of the region to replace (in unicode characters).
length The length of the region to replace (in unicode characters).
void insert(int index, char txt[])
Insert a string into the existing string.
index The location index at which to insert the string (indexes in unicode characters).
txt The raw encoded characters to insert.
void append(char txt[])
Append additional text to the end of the string.
txt The raw encoded characters to append.
char[] getRaw()
Get the raw encoded bytes of the string, usually used to output the string to a file or console.
int rawIndex(int charIndex)
Get the raw encoded byte index of the given unicode-indexed character.
int charIndex(int rawIndex)
Get the unicode-indexed character index of the given raw encoded byte index.
int4[] getCodepoints()
Get the string as an array of unicode codepoints.
void setCodepoints(int4 points[])
Set the string's value from an array of unicode codepoints.