当前位置:编程学习 > Delphi >>

delphi中输入一个汉字,如何编程序自动能够找到该汉字的机内码

追问:
如果我要显示多行文字,应该怎么改啊?请高手指教
不太明白你的意思,多行你可以循环把值给tmp,这不就把每行的都弄出来了吗,会一行的还不会多行的吗?
答案:tmp,httpstr,hzstr,tm: string;
 t1,t2: byte;
 ptr: ^byte;
 ii,jj,GBcode: integer;

begin        
 tmp:=edit1.Text; //字串
  ii:=1;
  hzstr:='';
  while ii<=length(tmp) do
  begin
  ptr:=@tmp[ii];
  t1:=ptr^;
  ptr:=@tmp[ii+1];
  t2:=ptr^;
  GBcode:=t2*$100+t1;
  tm:=inttostr(GBcode);
  GBcode:=strtoint(tm);
  label1.Caption:=inttohex(GBcode,0);
  hzstr:=hzstr+'%'+copy(label1.Caption,3,2)+'%'+copy(label1.Caption,1,2) ;
  ii:=ii+2;
  end;
我测试程序中的部分,有这方面的东西,应该你能取出你要的

上一个:delphi 邮件发送程序
下一个:delphi 7中,sqrt(0.5)乘以一个整数,比如3,得到结果P(整形)。程序怎么弄?有主程序就可以了。

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,