Sample code for 30+ languages & platforms
C

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat C Downloads

C
#include <C_CkStringBuilder.h>

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

    success = FALSE;

    sb = CkStringBuilder_Create();
    success = CkStringBuilder_Append(sb,"abc::def::ghi");

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

    printf("bFound = %d\n",bFound);
    printf("sb contains: %s\n",CkStringBuilder_getAsString(sb));

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


    CkStringBuilder_Dispose(sb);

    }