![]() |
Chilkat • HOME • Android™ • AutoIt • C • C# • C++ • Chilkat2-Python • CkPython • Classic ASP • DataFlex • Delphi DLL • Go • Java • Node.js • Objective-C • PHP Extension • Perl • PowerBuilder • PowerShell • PureBasic • Ruby • SQL Server • Swift • Tcl • Unicode C • Unicode C++ • VB.NET • VBScript • Visual Basic 6.0 • Visual FoxPro • Xojo Plugin
(Delphi ActiveX) Append Encoded Binary Data to StringBuilderDemonstrates how to append encoded binary data to the contenets of a StringBuilder.
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB; ... procedure TForm1.Button1Click(Sender: TObject); var bd: TChilkatBinData; success: Integer; sb: TChilkatStringBuilder; begin bd := TChilkatBinData.Create(Self); success := bd.LoadFile('qa_data/jpg/starfish.jpg'); if (success = 0) then begin Memo1.Lines.Add('Failed to load file.'); Exit; end; // For example, let's say we want construct simple JSON containing the base64 representation of the above JPG file. sb := TChilkatStringBuilder.Create(Self); sb.Append('{ "jpg": "'); // GetEncodedSb appends the enocded representation of the binary data to the StringBuiler passed in the 2nd arg. bd.GetEncodedSb('base64',sb.ControlInterface); sb.Append('" }'); Memo1.Lines.Add(sb.GetAsString()); // Output looks like this: // { "jpg": "/9j/4AAQSkZJRgABAg...rcQ+vo//2Q==" } end; |
||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.