String buffers
Factor handbook > The language > Collections

Prev:Byte vectors
Next:Resizable sequence implementation

The sbufs vocabulary implements resizable mutable sequence of characters. The literal syntax is covered in String buffer syntax.

String buffers implement the Sequence protocol and thus all Sequence operations can be used with them. String buffers can be used to construct new strings by accumulating substrings and characters, however usually they are only used indirectly, since the sequence construction words are more convenient to use in most cases (see Making sequences with variables).

String buffers form a class of objects:

sbuf? ( object -- ? )

Words for creating string buffers:
>sbuf ( seq -- sbuf )

<sbuf> ( n -- sbuf )

If you don't care about initial capacity, a more elegant way to create a new string buffer is to write:
SBUF" " clone