class haxe.Utf8Available in flash8, flash, neko, js, php, cpp, cs, javaSince all platforms does not guarantee that String always uses UTF-8 encoding, you can use this crossplatform API to perform operations on such strings. function new( ?size : Int ) : VoidAllocate a new Utf8 buffer using an optional bytes size. function addChar( c : Int ) : VoidAdd the given UTF8 character code to the buffer. function toString() : StringReturns the buffer converted to a String; static function charCodeAt( s : String, index : Int ) : IntSimilar to String.charCodeAt but uses the UTF8 character position. static function compare( a : String, b : String ) : IntCompare two UTF8 strings, character by character. static function decode( s : String ) : StringDecode an UTF8 string back to an ISO string. Throw an exception if a given UTF8 character is not supported by the decoder. static function encode( s : String ) : StringEncode the input ISO string into the corresponding UTF8 one. static function iter( s : String, chars : Int -> Void ) : VoidCall the chars function for each UTF8 char of the string. static function length( s : String ) : IntReturns the number of UTF8 chars of the String. static function sub( s : String, pos : Int, len : Int ) : StringThis is similar to String.substr but the pos and len parts are considering UTF8 characters. static function validate( s : String ) : BoolTells if the String is correctly encoded as UTF8.
version #16358, modified 2013-02-24 23:51:39 by api
0 comment