DataFlex
DataFlex
Example: Crypt2.EncodeString method
Demonstrates how to call the EncodeString method.Chilkat DataFlex Downloads
Use ChilkatAx-win32.pkg
Procedure Test
Handle hoCrypt
String s
String sTemp1
Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt
If (Not(IsComObjectCreated(hoCrypt))) Begin
Send CreateComObject of hoCrypt
End
Move "Hello World" To s
Get ComEncodeString Of hoCrypt s "utf-8" "hex" To sTemp1
Showln sTemp1
// Output: 48656C6C6F20576F726C64
Get ComEncodeString Of hoCrypt s "utf-16" "hex" To sTemp1
Showln sTemp1
// Output: 480065006C006C006F00200057006F0072006C006400
Get ComEncodeString Of hoCrypt s "utf-8" "base64" To sTemp1
Showln sTemp1
// Output: SGVsbG8gV29ybGQ=
Move "électricité" To s
Get ComEncodeString Of hoCrypt s "utf-8" "hex" To sTemp1
Showln sTemp1
// Output: C3A96C6563747269636974C3A9
Get ComEncodeString Of hoCrypt s "windows-1252" "hex" To sTemp1
Showln sTemp1
// Output: E96C6563747269636974E9
Get ComEncodeString Of hoCrypt s "windows-1252" "hex_lower" To sTemp1
Showln sTemp1
// Output: e96c6563747269636974e9
Get ComEncodeString Of hoCrypt s "utf-8" "url" To sTemp1
Showln sTemp1
// Output: %C3%A9lectricit%C3%A9
End_Procedure