Sample code for 30+ languages & platforms
DataFlex

StringBuilder RemoveAfterFinal

Demonstrates the StringBuilder.RemoveAfterFinal method.

The GetBefore method was added in Chilkat v9.5.0.77

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoSb
    Boolean iBFound
    String sTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSb
    If (Not(IsComObjectCreated(hoSb))) Begin
        Send CreateComObject of hoSb
    End
    Get ComAppend Of hoSb "abc::def::ghi" To iSuccess

    // Replace the 1st occurrence of a substring with another string.
    Get ComReplaceFirst Of hoSb "::" "-" To iBFound

    Showln "bFound = " iBFound
    Get ComGetAsString Of hoSb To sTemp1
    Showln "sb contains: " sTemp1

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


End_Procedure