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

StringBuilder ReplaceBetween

Demonstrates the ReplaceBetween method.

Chilkat Unicode C++ Downloads

Unicode C++
#include <CkStringBuilderW.h>

void ChilkatSample(void)
    {
    CkStringBuilderW sb;
    sb.Append(L"<company><industry>Software</industry><name>Chilkat Software</name><abc>Abc Software</abc><name>Xyz Software</name></company>");

    //  The ReplaceBetween method restricts the replacements to only
    //  the parts that occur between two delimiter strings.

    //  For example:
    int numReplacements = sb.ReplaceBetween(L"<name>",L"</name>",L"Software",L"Technology");

    //  The number of replacements should be 2.
    wprintf(L"numReplacements = %d\n",numReplacements);

    //  The sb now contains:
    //  <company><industry>Software</industry><name>Chilkat Technology</name><abc>Abc Software</abc><name>Xyz Technology</name></company>
    wprintf(L"%s\n",sb.getAsString());
    }