Sample code for 30+ languages & platforms
DataFlex Requires Chilkat v11.2.0+

Base62 Encoding and Decoding

Demonstrates base62 encoding and decoding.

Chilkat DataFlex Downloads

DataFlex
Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoBd
    Boolean iSuccess
    String sBase62_encoded
    Handle hoSb
    String sTemp1

    Get Create (RefClass(cComChilkatBinData)) To hoBd
    If (Not(IsComObjectCreated(hoBd))) Begin
        Send CreateComObject of hoBd
    End

    //  Base62 encode.
    Get ComAppendString Of hoBd "hello world" "utf-8" To iSuccess
    Get ComGetEncoded Of hoBd "base62" To sBase62_encoded
    Showln "hello world --> " sBase62_encoded

    //  Output: 
    //  hello world --> AAwf93rvy4aWQVw

    //  Base62 decode
    Get Create (RefClass(cComChilkatStringBuilder)) To hoSb
    If (Not(IsComObjectCreated(hoSb))) Begin
        Send CreateComObject of hoSb
    End
    Get ComDecodeAndAppend Of hoSb "AAwf93rvy4aWQVw" "base62" "utf-8" To iSuccess
    Get ComGetAsString Of hoSb To sTemp1
    Showln "decoded: " sTemp1

    //  Output:
    //  decoded: hello world


End_Procedure