Sample code for 30+ languages & platforms
DataFlex

StringBuilder GetEncoded

Demonstrates the Chilkat StringBuilder GetEncoded method.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    String s
    Handle hoSb
    Boolean iSuccess
    String sTemp1

    Move "The quick brown fox jumps over the lazy dog" To s

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

    Get ComAppend Of hoSb s To iSuccess

    // output: The quick brown fox jumps over the lazy dog
    Get ComGetAsString Of hoSb To sTemp1
    Showln sTemp1

    // Get the string encoded to base64, without changing the contents of sb.
    // output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
    Get ComGetEncoded Of hoSb "base64" "utf-8" To sTemp1
    Showln sTemp1

    // The contents of sb are not changed..
    // output: The quick brown fox jumps over the lazy dog
    Get ComGetAsString Of hoSb To sTemp1
    Showln sTemp1


End_Procedure