Sample code for 30+ languages & platforms
Unicode C

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat Unicode C Downloads

Unicode C
#include <C_CkStringBuilderW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkStringBuilderW sb;
    BOOL bFound;

    success = FALSE;

    sb = CkStringBuilderW_Create();
    success = CkStringBuilderW_Append(sb,L"abc::def::ghi");

    //  Replace the 1st occurrence of a substring with another string.
    bFound = CkStringBuilderW_ReplaceFirst(sb,L"::",L"-");

    wprintf(L"bFound = %d\n",bFound);
    wprintf(L"sb contains: %s\n",CkStringBuilderW_getAsString(sb));

    //  Output is:
    //  bFound = True
    //  sb contains: abc-def::ghi


    CkStringBuilderW_Dispose(sb);

    }