很简单
procedure TForm1.Button1Click(Sender: TObject);
var istr,str:string;
i:integer;
begin
     istr:='f45中%过人$`国``3.,';
     str:='';
     for i:=1 to length(istr) do
     begin
          if istr[i]>chr(127) then
          str:=str+istr[i];
     end;
     showmessage(str);
end;

解决方案 »

  1.   

    下面这个是文本文件里
    procedure TForm1.Button1Click(Sender: TObject);
    var istr,str:string;
    i:integer;
    ST:TSTRINGLIST;
    begin
      try
       ST:=TSTRINGLIST.Create;
       ST.LoadFromFile('h:\aaa.TXT');
       ISTR:=ST.TEXT;
         str:='';
         for i:=1 to length(istr) do
         begin
              if istr[i]>chr(127) then
              str:=str+istr[i];
         end;
         showmessage(str);
      finally
            st.free;
      end;
    end;
      

  2.   

    Ord()函数就可以把字符转换为对应的数值,值33-126为键盘可使用字符,值127以上的为未知字符,即为汉字
    procedure TForm1.Button1Click(Sender: Tobject);
    var s:string;
    I,e,c:integer;
    begin
    s:=memo1.text;
    e:=0;c:=0;
    for I:=1 to length(s) do
    begin
    if (ord(s[I])>=33)and(ord(s[I])<=126) then
    begin
    inc(e);
    label1.caption:='英文字数:'+inttostr(e);
    end
    else
    if (ord(s[I])>=127) then
    begin
    inc(c);
    label2.caption:='中文字数:'+inttostr(c div 2);
    end;
    end;
    end;
      

  3.   

    suny_2001(小鱼儿),厉害,赢了一顿饭,谢谢你。
      

  4.   

    MouseBrother() 对不起啊,加分是没有看见你的帖子。加不上分了,have no chance but to next time 。