delphi 判断 中文字符


本文整理自网络,侵删。

 delphi 判断 中文字符
sql正则表达:
select * from gamelog.game2_0log_100_20121012 where not objectname regexp "[\x4e00-\x9fff]"
缺点: 只能查询到完全中文(字符中不包括任何非中文)

mysql:
SELECT * FROM gamelog.game2_0log_100_20121012  where char_length(objectname)!=length(objectname)
缺点:只对 字符中 包括 中文 和外文的有用 (双字节判断)

 
delphi: 
function TForm2.IsCN(sText: string): Boolean;
var
  I: Integer;
begin
  Result := False;
  if sText = '' then Exit;
  for I := 0 to Length(sText) do
  begin
    if (Ord(sText[I]) >= $4E00{19968})  and  (Ord(sText[I]) <=  $9FA5{40869}) then
    begin
      Result := True;
      break;
    end;
  end;
end;

相关阅读 >>

Delphi mysql里Delphi事件类型转unix时间戳

Delphi unigui确认对话框

Delphi 映像劫持编辑器

Delphi实现拖动无标题窗口的5种方法

Delphi ansiendstext 用法之一(路径结尾自动加\)

Delphi 内存管理1

Delphi winapi: getforegroundwindow - 获取前台窗口的句柄

Delphi 动态调用chm文件

Delphi for xx in xx do 语法的使用示例

Delphi webbrowser控件实现对ie浏览器的各种控制

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...