--> how to convert string to hexadecimal format with delphi | Delphi Tips Trick

For Newbie

Tuesday 15 November 2011

how to convert string to hexadecimal format with delphi

| Tuesday 15 November 2011
string to hexa decimal delphi




The following is how to convert string to hexadecimal format with delphi


Function declaration:



function StrHex(inp: String): String;
var
  i: Integer;
  cStr: String;
begin
  for i:= 1 to Length(inp) do cStr:= cStr + IntToHex(Ord(inp[i]), 2) + ' ';
  Result:= cStr;
end;

the implementation
procedure TForm1.Button1Click(Sender: TObject);
begin
  with Memo1.Lines do
  begin
    Clear;
    Add(StrHex(Edit1.Text));
  end;
end;

Related Posts

No comments: