delphi 中如何讲 中英文混合字符转成 字节数组
delphi吧
全部回复
仅看楼主
level 3
huangchao209 楼主
delphi 中如何讲 中英文混合字符串转成 字节数组
在吧 字节数组 转换 字符串 string
2014年11月20日 02点11分 1
吧务
level 14
PlatformBytesOf
2014年11月20日 03点11分 2
level 10
TEncoding.xxx编码.GetBytes。绝对的跨平台。
2014年11月20日 03点11分 3
level 10
Tencodng.xxx编码.Getstring 。只要你编码选对了,也毫无问题。
2014年11月20日 03点11分 4
level 10
function PlatformBytesOf(const Value: string): TBytes;
begin
Result := TEncoding.Unicode.GetBytes(Value);
end;
function PlatformStringOf(const Value: TBytes): UnicodeString;
begin
if Assigned(Value) then
begin
Result := TEncoding.Unicode.GetString(Value, Low(Value), High(Value) + 1);
end
else
Result := '';
end;
这是官方的代码,也是用 TEncoding 。
2014年11月20日 03点11分 5
请问下这个DELPHI 7里面有吗
2014年11月20日 04点11分
回复 huangchao209 :请使用 XE7UP1 。
2014年11月20日 04点11分
level 9
jrh
2014年12月02日 10点12分 6
level 3
看来我应该换版本了
2014年12月05日 05点12分 7
1