Extracted from Pike v7.3 release 18 at 2002-03-27.
pike.roxen.com
[Top]
String
String.Buffer

Class String.Buffer

Description

A buffer, used for building strings. It's conceptually similar to a string, but you can only String.Buffer.add strings to it, and you can only String.Buffer.get the value from it once.

There is a reason for those seemingly rather odd limitations, it makes it possible to do some optimizations that really speed things up.

You do not need to use this class unless you add very many strings together, or very large strings.

Example

For the fastest possible operation, write your code like this:


    String.Buffer b = String.Buffer( );

    function add = b->add;

    .. call add several times in code ...

    string result = b->get(); // also clears the buffer