Delphi Unicode转中文

function UniCode2GB(S : String):String;
Var I: Integer;
begin
I := Length(S);
while I >=4 do begin
try
Result :=WideChar(StrToInt('$'+S[I-3]+S[I-2]+S[I-1]+S[I]))+ Result;
except end;
I := I - 4;
end;
end;

procedure TForm1.btn1Click(Sender: TObject);
begin
    ShowMessage(UniCode2GB('\u51e4')+UniCode2GB('\u51f0'));
    //显示  凤凰
end;

Posted in 软件开发 by 傻猫 at February 3, 2013.
Tags: unicode, UniCode2GB

添加新评论