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;
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;
begin
with Memo1.Lines do
begin
Clear;
Add(StrHex(Edit1.Text));
end;
end;
No comments:
Post a Comment