- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 串口 字符串转换ASCII
function StrToASCIIStr(const S: string): string;
var
i: Integer;
begin
for i:= 1 to Length(S) do
begin
if i = 1 then
Result:= IntToHex(Ord(S[1]), 2)
else
Result:= Result + ' ' + IntToHex(Ord(S[i]), 2);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ShowMessage(StrToASCIIStr('中国'));
end;