This abstract provides consistent cross-target unicode support for characters of any width.
Due to differing internal representations of strings across targets, only the basic
multilingual plane (BMP) is supported consistently by String
class.
This abstract provides API to consistently handle all characters even beyond BMP.
See also:
Static variables
Static methods
staticcharAt(this:String, index:Int):String
Available on js, jvm, cpp, flash, hl
Returns the character at position index
of this
String.
If index
is negative or exceeds this.length
, the empty String ""
is returned.
staticcharCodeAt(this:String, index:Int):Null<Int>
Available on js, jvm, cpp, flash, hl
Returns the character code at position index
of this
String.
If index
is negative or exceeds this.length
, null
is returned.
staticindexOf(this:String, str:String, ?startIndex:Int):Int
Available on js, jvm, cpp, flash, hl
See also:
String.indexOf
staticinlineiterator(this:String):StringIteratorUnicode
Available on js, jvm, cpp, flash, php, macro, hl, lua, python
Returns an iterator of the unicode code points.
staticinlinekeyValueIterator(this:String):StringKeyValueIteratorUnicode
Available on js, jvm, cpp, flash, php, macro, hl, lua, python
Returns an iterator of the code point indices and unicode code points.
staticlastIndexOf(this:String, str:String, ?startIndex:Int):Int
Available on js, jvm, cpp, flash, hl
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.
staticsubstr(this:String, pos:Int, ?len:Int):String
Available on js, jvm, cpp, flash, hl
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.
staticsubstring(this:String, startIndex:Int, ?endIndex:Int):String
Available on js, jvm, cpp, flash, hl
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.