|  | 
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 DLL) URL Encoding and DecodingDemonstrates URL encoding and decoding. 
 uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, StringBuilder; ... procedure TForm1.Button1Click(Sender: TObject); var s: PWideChar; sb: HCkStringBuilder; success: Boolean; sEncoded: PWideChar; numReplaced: Integer; begin // To URL encoding a string: s := 'Why a > b?'; sb := CkStringBuilder_Create(); success := CkStringBuilder_Append(sb,s); // URL encode the string. CkStringBuilder_Encode(sb,'url','utf-8'); // Show the URL encoded string: sEncoded := CkStringBuilder__getAsString(sb); Memo1.Lines.Add(sEncoded); // The result is: Why%20a%20%3E%20b%3F // If you prefer "+" instead of "%20" for SPACE chars: numReplaced := CkStringBuilder_Replace(sb,'%20','+'); Memo1.Lines.Add(CkStringBuilder__getAsString(sb)); // Output is: Why+a+%3E+b%3F // To decode: CkStringBuilder_Decode(sb,'url','utf-8'); Memo1.Lines.Add(CkStringBuilder__getAsString(sb)); // Result is: Why a > b? CkStringBuilder_Dispose(sb); end; | ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.