用记事本打开dfm文件,如果包括中文的话,都是用 #+一串数字表示的如何把这个转换出来?
解决方案 »
- 求heromovie控件及编程说明,要多少分给多少,有的是!
- 为什么用delphi写的服务程序无法访问网络路径????但在调试时可以访问,谢谢大虾的回答,我在线等待?????
- 难题,在线等待..............
- 加入网格计算,找寻SARS解药!
- 帮我解决一个问题好吗?
- 各位兄弟姐妹:
- 我是Delphi的初学者,哪里有Delphi电子书籍下载,请给出网址!
- 壮胆送分贴(两个三角的勿进)。
- 请问在ADO中batchdate的filtergroup的用法
- 在Timer中,要实现按下某按纽,应该怎么做?
- msn空间 自动提交新博客文章,怎么作呢?它的网页代码比较特别,找不到input与Form:(
- 24个不同数据库进行数据采集然后插入到一个中心数据库中的问题。
很容易转换的
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses myfunc;
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
cText:TextFile;
s,t:string;
w:widestring; //#后面代表的汉字
i,n,lens,j:Integer;
begin
AssignFile(cText,'cnCurrencyU.dfm');
try
Reset(cText);
while not eof(cText) do
begin
Readln(cText,s);
if pos('#',s)>0 then
begin
lens:=Length(s);
s:=copy(s,pos('#',s),lens-pos('#',s)+1);
n:=SubStrNum('#',s); //myfunc
Memo1.Lines.Add(s);
w:='';
for i := 1 to n do
begin
j:=pos('#',s);
t:=Copy(s,j+1,5);
Delete(s,1,j);
w:=w+widechar(strtoint(t));
end;
Memo1.Lines.Add(w);
end;
end;
finally
CloseFile(cText);
end;end;end.
//2.将文本文件中的Unicode转为中文
下面是Unicode与汉字的对应表var
w: WideString;
i: Integer;
s: string;
List: TStringList;
begin
List := TStringList.Create; for i := $4e00 to $9fa5 do
begin
s := #36 + IntToHex(i,4); {#36 是 $ 字符}
w := WideChar(i);
List.Add(s + '=' + w);
end; List.SaveToFile('c:\temp\Unicode-Hz.txt');
List.Free;
end;