Delphi Unicode转换Ansi


本文整理自网络,侵删。

 
function UnicodeToAnsi(aSubUnicode: string): string;
var
  tmpLen, iCount: Integer;
  tmpWS: WideString;
begin
  tmpWS := '';
  iCount := 1;
  tmpLen := Length(aSubUnicode);
  while iCount <= tmpLen do
    try
      if (Copy(aSubUnicode, iCount, 1) = '\')
        and (Copy(aSubUnicode, iCount, 2) = '\u') then
      begin
        tmpWS := tmpWS
          + WideChar(StrToInt('$' + Copy(aSubUnicode, iCount + 2, 4)));
        iCount := iCount + 6;
      end
      else
      begin
        tmpWS := tmpWS + Copy(aSubUnicode, iCount, 1);
        iCount := iCount + 1;
      end;
    except
    end;
  Result := tmpWS;
end;

相关阅读 >>

Delphi 判断是否是系统管理员身份

Delphi 一个拼图工具的制作思路

Delphi 通过窗口特定标题锁定窗口

Delphi学习sql语句 - insert、update、delete

crc32.pas

Delphi 获取所有窗口标题

Delphi 10.4 freeandnil 问题

Delphi调用wmi读取usb设备的pid和vid

idftp无法设置transfertype属性

Delphi idhttp实现地址自动转向

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...