# class Utf8

#### package haxe

Available on Android, iOS, Linux, macOS, Neko, Windows

Since not all platforms guarantee that `String` always uses UTF-8 encoding, you can use this cross-platform API to perform operations on such strings.

### Constructor

###

`new (?size:Int)`

Allocate a new Utf8 buffer using an optional bytes size.

### Methods

###

`addChar (c:Int):Void`

Add the given UTF8 character code to the buffer.

###

`toString ():String`

Returns the buffer converted to a String.

### Static methods

###

`staticiter (s:String, chars:Int ‑> Void):Void`

Available on Neko

Call the `chars` function for each UTF8 char of the string.

###

`staticlength (s:String):Int`

Returns the number of UTF8 chars of the String.