Sample code for 30+ languages & platforms
DataFlex

StringBuilder RemoveBefore

Demonstrates the StringBuilder.RemoveBefore 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
    String sMarker
    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 "http://www.chilkatsoft.com" To iSuccess

    // 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.
    Move "//" To sMarker
    Get ComRemoveBefore Of hoSb sMarker To iBFound

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

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


End_Procedure