//获得汉字字符个数 function ChineseWordsCount(text:string):Integer; var i,sum,e,c,t: Integer; begin Result:=0;
c := 0; sum := Length(text);
if Sum=0 then exit; for i := 0 to sum do begin if Ord(text[i]) >= 127 then begin Inc(c); end; end; Result:=c;
end;
//获得非汉字字符个数 function EnglishWordsCount(text:string):Integer; var i,sum,e: Integer; begin Result:=0; e := 0; sum := Length(text); if sum=0 then exit; for i := 0 to sum do begin if (Ord(text[i]) >= 33) and (Ord(text[i]) <= 126) then begin Inc(e); end; end; Result:=e;
end;
procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(IntToStr(ChineseWordsCount(Memo1.Text))); end;
//获得汉字字符个数function ChineseWordsCount(text:string):Integer;var i,sum,e,c,t: Integer;begin Result:=0; c := 0; sum := Length(text); if Sum=0 then exit; for i := 0 to sum do begin if Ord(text[...