1,183
社区成员
发帖
与我相关
我的任务
分享
//根据国标 GB2312 的中文汉字及符号 区位码的范围判断
Function CheckIsGB2312(Char : WideChar) : Boolean;
var
S : AnsiString;
begin
S := Char;
Result := (PByte(integer(S)+1)^>=$A1) and (PByte(integer(S)+1)^<=$FE) and
(PByte(S)^>=$B0) and (PByte(S)^<=$F7);
end;
//检查是否都是可见英文字符或者汉字及符号,全部是返回True否则False,空格认为可见
Function StrIsCanShow(Const WS : WideString) : Boolean;
var
i : integer;
P : PWideChar;
begin
Result := True;
P := Pointer(WS);
for i:=1 to Length(WS) do begin
if not (
((PWord(P)^>=$20) and (PWord(P)^<=$7E)) //Ansi 可见字符
or CheckIsGB2312(P^) //GB2312汉字及符号
) then begin
Result := False;
Break;
end;
Inc(P);
end;
end;