汉字的两个字节的ASCII值都大于128,而字母确都小于128。这就是区别。

解决方案 »

  1.   

    一点也不复杂,GB2312汉字的内码>160,
         <160去掉   s:='中1华2121人fdg民dfg共fdg和fdg国';
       hz:='';
       for i:=1 to Length(s) do
         begin
             c:=ord(s[i]);
             if (c>160) then
                hz:=hz+String(chr(c));
         end;
      ShowMessage(hz);
      

  2.   

    但:  GBK就稍复杂了,它的第一个字节内码 >128,
         但汉字的第二个字节就不是这样了,可能为字母和数字,但 >=32
      

  3.   

    搞定了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}
    function GetHz(s:string):string;
    var hz:string;i:integer;
    begin
       hz:='';
       for i:=1 to length(s) do
          begin
             if ByteType(s,i)<>mbSingleByte then  {是汉字}
                hz:=hz+s[i];
          end;
        GetHz:=hz;
    end;
    procedure TForm1.Button1Click(Sender: TObject);
    var s:String;
    begin
       s:='121中123华343人34民34共34和fdg国';
       ShowMessage(GetHz(s));
    end;end.