Sample code for 30+ languages & platforms
Unicode C++

StringBuilder ReplaceWord

Demonstrates the ReplaceWord method.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkStringBuilderW.h>

void ChilkatSample(void)
    {
    CkStringBuilderW sb;
    sb.Append(L"forest, lumber, lumberjack, jack, timberland");

    //  The ReplaceWord method replaces word occurances.

    //  For example:
    int numReplacements = sb.ReplaceWord(L"lumber",L"timber");
    numReplacements = sb.ReplaceWord(L"jack",L"joe");

    //  The string content is now:
    //  forest, timber, lumberjack, joe, timberland
    wprintf(L"%s\n",sb.getAsString());
    }