Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.1

# StrBuf - string manipulation

The `StrBuf` class is the preferred general string manipulation class. This class manages the memory associated with a string, including allocating new memory or freeing old memory as required.

The `StrBuf` class is derived from the `StrPtr` class, and makes heavy use of the `buffer` and `length` members inherited from the `StrPtr` class. The `buffer` member of a `StrBuf` instance is a pointer to the first byte in the string. The `length` member of a `StrBuf` instance is the length of the string.

Most member functions maintain the string pointed to by the `buffer` member of a `StrBuf` as a null-terminated string. However, the `Clear` member function does not set the first byte of the string to a null byte, nor does the `Extend` member function append a null byte to an extended string. If you need to maintain a string as null-terminated when using the `Clear()` and `Extend()` member functions, follow the calls to `Clear()` and `Extend()` with calls to `Terminate()`.

A number of member functions move the string pointed to by a `StrBuf`'s buffer, and change the `buffer` member to point to the new location. For this reason, do not cache the pointer. Use `StrPtr::Text()` whenever the pointer a `StrBuf`'s buffer is required.

Your search for returned results