Sample code for 30+ languages & platforms
DataFlex

Remove a Range of Chars from a StringBuilder

Demonstrates how to remove a range of chars from the string contained in a StringBuilder object.

Note: This example demonstrates the RemoveCharsAt method which was added in Chilkat v9.5.0.87.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Boolean iSuccess
    Handle hoSb
    String sTemp1

    Move False To iSuccess

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSb
    If (Not(IsComObjectCreated(hoSb))) Begin
        Send CreateComObject of hoSb
    End

    // Load a file that contains this string:  0123456789ABCDEF
    Get ComLoadFile Of hoSb "qa_data/txt/remove_chars.txt" "utf-8" To iSuccess

    // Remove "56789A" from the string.
    Get ComRemoveCharsAt Of hoSb 5 6 To iSuccess

    Get ComGetAsString Of hoSb To sTemp1
    Showln sTemp1

    // Output is: 01234BCDEF


End_Procedure