procedure TForm1.Button1Click(Sender: TObject);
var
s1,s2:array[0..2] of char;
b:byte;
i:integer;
begin
caption:='';
s1:='我'; s2:='me';
if windows.isDBCSLeadByte(byte(s1[0])) then
caption:=caption+'s1 is HZ '
else
caption:=caption+'s1 is Eng ';
if windows.isDBCSLeadByte(byte(s2[0])) then
caption:=caption+'s2 is HZ '
else
caption:=caption+'s2 is Eng ';
end;
c:integer;
Str:string;
astr1char;
astr:Char;
begin
c:=1;
while c<strlen(pchar(Str))+1 do
begin
astr1:=pchar(copy(Str,c,1));
astr:=astr1^;
if ord(astr)>128 then
begin
//是汉字;
end
else
begin
//非汉字;
end;
end;
end;
//只要把string转换成 widestring,然后 如果长度 大于1 代表亚洲字符
function howmanychinese(const s:string):integer;
var c:string;
sw:widestring;
i,wcount:integer;
begin
sw:=s;
wcount:=0;
for i:=1 to length(sw) do
begin
c:=sw;
if length(c)>1 then inc(wcount);
end;
result:=wcount;
end;
function GetStrType(aChStr:string):String;
var
sChar : string;
bNeedNext : Boolean;
i : integer;//Looper
begin
Result := '';
bNeedNext := false;
sChar := '';
for i := 1 to Length(aChStr) do
if Ord(aChStr) <= 127 then
Result := Result + 'E'
else
begin
bNeedNext := not bNeedNext;
sChar := sChar + aChStr;
if bNeedNext then continue;
Result := Result + 'C';
sChar := '';
end;//case
end;