给一个比较笨的办法 function test(str:string):boolean;//返回为True则字符串中有中文 var enStr:string; cnStr:widestring; begin enStr := str; cnStr := wideString(str); result := length(enStr)<> length(cnStr); end;
function IsHz(Source: string): Boolean; begin result := ((Word(Source[1]) shl 8 + Word(Source[2])) >= $B0A1) and ((Word(Source[1]) shl 8 + Word(Source[2])) <= $D7F9) end;
eWebForm.Go(cobAddress.Url, False)
else
eWebForm.Go('http://www.baidu.com//s?wd='+cobaddress.Text, False) ; end;
判断cobAddress.Url是中文还是英文
//以下是判断字符是单字节还是双字节
ByteType('123你好吗',1) = mbSingleByte //单字节
ByteType('123你好吗',4) = mbLeadByte //双字节字符的第一个字符
ByteType('123你好吗',5) = mbTrailByte //双字节字符的第二个字符
function test(str:string):boolean;//返回为True则字符串中有中文
var
enStr:string;
cnStr:widestring;
begin
enStr := str;
cnStr := wideString(str);
result := length(enStr)<> length(cnStr);
end;
function IsHz(Source: string): Boolean;
begin
result := ((Word(Source[1]) shl 8 + Word(Source[2])) >= $B0A1) and ((Word(Source[1]) shl 8 + Word(Source[2])) <= $D7F9)
end;