登记注册 登录
Ee23时尚网 返回首页

ljzbhy的个人空间 http://ee23forum.net/?1 [收藏] [复制] [分享] [RSS]

日志

判断是否为中文

热度 9已有 1319 次阅读2009-12-11 23:49 |个人分类:js脚本

  <script language="vbscript">
 '使用正则表达式验证String1是否匹配Pattern
Public Function Validation(Pattern, String1)
    Dim RegExp1, Matches
 '建立正则表达式
    Set RegExp1 = New RegExp
 '设置模式
    RegExp1.Pattern = Pattern
 '设置是否区分字符大小写
    RegExp1.IgnoreCase = True
 '设置全局可用性
    RegExp1.Global = True
    Matches = RegExp1.Test(String1)
    Validation = Matches
End Function

'验证String1是否为中文,是则返回True,否则返回False
Public Function CheckIsEmpty(String1)   
 CheckIsEmpty = Validation("^[\u4e00-\u9fa5]+$", Trim(String1))
End Function

MsgBox ("我是中国人"&vbcrlf&"验证为:"&CheckIsEmpty("我是中国人"))
MsgBox ("you name?"&vbcrlf&"验证为:"&CheckIsEmpty("you name?"))


</script>

1

路过
1

鸡蛋

鲜花
1

握手

雷人

评论 (0 个评论)

facelist

*滑块验证:

您需要登录后才可以评论 登录 | 登记注册

手机版|Archiver|Ee23时尚网 ( 粤ICP备09167417号-1 )

GMT+8, 2024-4-17 05:20

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

返回顶部