This abstract provides consistent cross-target unicode support.

See:

Constructor

@:impl@:noCompletioninlinenew (string:String)

Available on flash, lua, python, macro, cpp, cs, js, hl, php, java

Creates an instance of UnicodeString.

Variables

@:implread onlylength:Int

Available on flash, cpp, cs, js, hl, java

The number of characters in this String.

Methods

@:implcharAt (index:Int):String

Available on flash, cpp, cs, js, hl, java

Returns the character at position index of this String.

If index is negative or exceeds this.length, the empty String "" is returned.

@:implcharCodeAt (index:Int):Null<Int>

Available on flash, cpp, cs, js, hl, java

Returns the character code at position index of this String.

If index is negative or exceeds this.length, null is returned.

@:implindexOf (str:String, ?startIndex:Int):Int

Available on flash, cpp, cs, js, hl, java

Returns the position of the leftmost occurrence of str within this String.

If startIndex is given, the search is performed within the substring of this String starting from startIndex (if startIndex is posivite or 0) or max(this.length + startIndex, 0) (if startIndex is negative).

If startIndex exceeds this.length, -1 is returned.

Otherwise the search is performed within this String. In either case, the returned position is relative to the beginning of this String.

If str cannot be found, -1 is returned.

@:implinlineiterator ():StringIteratorUnicode

Available on flash, lua, python, macro, cpp, cs, js, hl, php, java

Returns an iterator of the unicode code points.

@:implinlinekeyValueIterator ():StringKeyValueIteratorUnicode

Available on flash, lua, python, macro, cpp, cs, js, hl, php, java

Returns an iterator of the code point indices and unicode code points.

@:impllastIndexOf (str:String, ?startIndex:Int):Int

Available on flash, cpp, cs, js, hl, java

Returns the position of the rightmost occurrence of str within this String.

If startIndex is given, the search is performed within the substring of this String from 0 to startIndex + str.length. Otherwise the search is performed within this String. In either case, the returned position is relative to the beginning of this String.

If str cannot be found, -1 is returned.

@:implsubstr (pos:Int, ?len:Int):String

Available on flash, cpp, cs, js, hl, java

Returns len characters of this String, starting at position pos.

If len is omitted, all characters from position pos to the end of this String are included.

If pos is negative, its value is calculated from the end of this String by this.length + pos. If this yields a negative value, 0 is used instead.

If the calculated position + len exceeds this.length, the characters from that position to the end of this String are returned.

If len is negative, the result is unspecified.

@:implsubstring (startIndex:Int, ?endIndex:Int):String

Available on flash, cpp, cs, js, hl, java

Returns the part of this String from startIndex to but not including endIndex.

If startIndex or endIndex are negative, 0 is used instead.

If startIndex exceeds endIndex, they are swapped.

If the (possibly swapped) endIndex is omitted or exceeds this.length, this.length is used instead.

If the (possibly swapped) startIndex exceeds this.length, the empty String "" is returned.

Static methods

staticvalidate (b:Bytes, encoding:Encoding):Bool

Tells if b is a correctly encoded UTF8 byte sequence.