Sample code for 30+ languages & platforms
C

StringBuilder RemoveBefore

Demonstrates the StringBuilder.RemoveBefore 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;
    const char *marker;
    BOOL bFound;

    success = FALSE;

    sb = CkStringBuilder_Create();
    success = CkStringBuilder_Append(sb,"http://www.chilkatsoft.com");

    //  The RemoveBefore method removes the chars up to and including the marker string.
    //  If the marker is not found, then nothing is removed and the method returns FALSE.
    marker = "//";
    bFound = CkStringBuilder_RemoveBefore(sb,marker);

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

    //  Output is:
    //  bFound = TRUE
    //  sb contains: www.chilkatsoft.com


    CkStringBuilder_Dispose(sb);

    }