A String buffer is an efficient way to build a big string by appending small elements together.

Its cross-platform implementation uses String concatenation internally, but StringBuf may be optimized for different targets.

Unlike String, an instance of StringBuf is not immutable in the sense that it can be passed as argument to functions which modify it by appending more values. However, the internal buffer cannot be modified.


new ()

Creates a new StringBuf instance.

This may involve initialization of the internal buffer.


read only write only length:Int

Available on js-client, js-node, php

The length of this StringBuf in characters.

read only length:Int

Available on neko

The length of this StringBuf in characters.


add<T> (x:T):Void

Available on js-client, js-node, php

Appends the representation of x to this StringBuf.

The exact representation of x may vary per platform. To get more consistent behavior, this function should be called with Std.string(x).

If x is null, the String "null" is appended.

inline addChar (c:Int):Void

Available on js-node

Appends the character identified by c to this StringBuf.

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