W3cubDocs

/Haxe

Ucs2(String)

package haxe

Available on all platforms

Cross platform UCS2 string API.

Variables

@:impl @:extern read only length:Int

Methods

@:impl @:extern inline charAt (this:String):Ucs2

Returns the character at position index of this Ucs2.

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

@:impl @:extern inline charCodeAt (this:String):Null<Int>

Returns the character code at position index of this Ucs2.

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

To obtain the character code of a single character, "x".code can be used instead to @:extern public inline the character code at compile time. Note that this only works on Ucs2 literals of length 1.

@:impl @:extern inline indexOf (this:String, str:Ucs2):Int

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

If startIndex is given, the search is performed within the substring of this Ucs2 starting from startIndex. Otherwise the search is performed within this Ucs2. In either case, the returned position is relative to the beginning of this Ucs2.

If str cannot be found, -1 is returned.

@:impl @:extern inline lastIndexOf (this:String, str:Ucs2):Int

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

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

If str cannot be found, -1 is returned.

@:impl @:extern inline split (this:String):Array<Ucs2>

Splits this Ucs2 at each occurrence of delimiter.

If this Ucs2 is the empty Ucs2 "", the result is not consistent across targets and may either be [] (on Js, Cpp) or [""].

If delimiter is the empty Ucs2 "", this Ucs2 is split into an Array of this.length elements, where the elements correspond to the characters of this Ucs2.

If delimiter is not found within this Ucs2, the result is an Array with one element, which equals this Ucs2.

If delimiter is null, the result is unspecified.

Otherwise, this Ucs2 is split into parts at each occurrence of delimiter. If this Ucs2 starts (or ends) with delimiter, the result Array contains a leading (or trailing) empty Ucs2 "" element. Two subsequent delimiters also result in an empty Ucs2 "" element.

@:impl @:extern inline substr (this:String, pos:Int):Ucs2

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

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

If pos is negative, its value is calculated from the end of this Ucs2 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 Ucs2 are returned.

If len is negative, the result is unspecified.

@:impl @:extern inline substring (this:String, startIndex:Int):Ucs2

Returns the part of this Ucs2 from startIndex to 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 Ucs2 "" is returned.

@:impl @:extern inline toLowerCase ():Ucs2

Returns a Ucs2 where all characters of this Ucs2 are lower case.

Affects the characters A-Z. Other characters remain unchanged.

@:impl @:extern inline toNativeString ():String

Returns the native underlying String.

@:impl @:extern inline toUpperCase ():Ucs2

Returns a Ucs2 where all characters of this Ucs2 are upper case.

Affects the characters a-z. Other characters remain unchanged.

Static variables

@:impl @:extern static read only length:Int

Static methods

@:impl @:extern static inline charAt (this:String):Ucs2

Returns the character at position index of this Ucs2.

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

@:impl @:extern static inline charCodeAt (this:String):Null<Int>

Returns the character code at position index of this Ucs2.

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

To obtain the character code of a single character, "x".code can be used instead to @:extern public inline the character code at compile time. Note that this only works on Ucs2 literals of length 1.

@:extern static inline fromCharCode (code:Int):Ucs2

Returns the Ucs2 corresponding to the character code code.

If code is negative or has another invalid value, the result is unspecified.

@:extern static inline fromCharCode (code:Int):Ucs2

Returns the Ucs2 corresponding to the character code code.

If code is negative or has another invalid value, the result is unspecified.

@:impl @:extern static inline indexOf (this:String, str:Ucs2):Int

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

If startIndex is given, the search is performed within the substring of this Ucs2 starting from startIndex. Otherwise the search is performed within this Ucs2. In either case, the returned position is relative to the beginning of this Ucs2.

If str cannot be found, -1 is returned.

@:impl @:extern static inline lastIndexOf (this:String, str:Ucs2):Int

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

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

If str cannot be found, -1 is returned.

@:impl @:extern static inline split (this:String):Array<Ucs2>

Splits this Ucs2 at each occurrence of delimiter.

If this Ucs2 is the empty Ucs2 "", the result is not consistent across targets and may either be [] (on Js, Cpp) or [""].

If delimiter is the empty Ucs2 "", this Ucs2 is split into an Array of this.length elements, where the elements correspond to the characters of this Ucs2.

If delimiter is not found within this Ucs2, the result is an Array with one element, which equals this Ucs2.

If delimiter is null, the result is unspecified.

Otherwise, this Ucs2 is split into parts at each occurrence of delimiter. If this Ucs2 starts (or ends) with delimiter, the result Array contains a leading (or trailing) empty Ucs2 "" element. Two subsequent delimiters also result in an empty Ucs2 "" element.

@:impl @:extern static inline substr (this:String, pos:Int):Ucs2

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

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

If pos is negative, its value is calculated from the end of this Ucs2 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 Ucs2 are returned.

If len is negative, the result is unspecified.

@:impl @:extern static inline substring (this:String, startIndex:Int):Ucs2

Returns the part of this Ucs2 from startIndex to 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 Ucs2 "" is returned.

@:impl @:extern static inline toLowerCase ():Ucs2

Returns a Ucs2 where all characters of this Ucs2 are lower case.

Affects the characters A-Z. Other characters remain unchanged.

@:impl @:extern static inline toNativeString ():String

Returns the native underlying String.

@:impl @:extern static inline toUpperCase ():Ucs2

Returns a Ucs2 where all characters of this Ucs2 are upper case.

Affects the characters a-z. Other characters remain unchanged.

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/haxe/Ucs2.html