Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Delphi DLL) Base64 Encode/Decode a StringDelphi DLL example to base-64 encode and decode a string.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, BinData; ... procedure TForm1.Button1Click(Sender: TObject); var bd: HCkBinData; s: PWideChar; success: Boolean; strBase64: PWideChar; bd2: HCkBinData; decoded: PWideChar; begin bd := CkBinData_Create(); s := 'A friend called me up the other day and talked about investing in a dot-com that sells lobsters. Internet lobsters. Where will this end? --Donald Trump'; success := CkBinData_AppendString(bd,s,'utf-8'); strBase64 := CkBinData__getEncoded(bd,'base64'); Memo1.Lines.Add(strBase64); // To decode: bd2 := CkBinData_Create(); CkBinData_AppendEncoded(bd2,strBase64,'base64'); decoded := CkBinData__getString(bd2,'utf-8'); Memo1.Lines.Add(decoded); CkBinData_Dispose(bd); CkBinData_Dispose(bd2); end; |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.