2009-11-06 | #1 (permalink) |
高级会员
|
将uniCode转化为中文的代码
以下是将uniCode转换为中文的代码。
function TfrmMain.ReadHex(AString: string): integer; begin Result:=StrToInt('$'+AString) end; function TfrmMain.UnicodeToAnsi(Unicode: string): string; var s:string; i:integer; j,k:string[2]; begin i:=1; s:=''; while i j:=Copy(Unicode,i+2,2); k:=Copy(Unicode,i,2); i:=i+4; s:=s+Char(ReadHex(j))+Char(ReadHex(k)); end; if s<>'' then s:=WideCharToString(PWideChar(s+#0#0#0#0)) else s:=''; Result:=s; end; |