(Delphi ActiveX) StringBuilder GetEncoded
Demonstrates the Chilkat StringBuilder GetEncoded method.
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
s: WideString;
sb: TChilkatStringBuilder;
begin
s := 'The quick brown fox jumps over the lazy dog';
sb := TChilkatStringBuilder.Create(Self);
sb.Append(s);
// output: The quick brown fox jumps over the lazy dog
Memo1.Lines.Add(sb.GetAsString());
// Get the string encoded to base64, without changing the contents of sb.
// output: VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw==
Memo1.Lines.Add(sb.GetEncoded('base64','utf-8'));
// The contents of sb are not changed..
// output: The quick brown fox jumps over the lazy dog
Memo1.Lines.Add(sb.GetAsString());
end;
|