$("form").submit(function () { var content = editor.getContentTxt(); var sum = 0; re = /[\u4E00-\u9FA5]/g; //测试中文字符的正则 if (content) { if (re.test(content)) //使用正则判断是否存在中文 { if (content.match(re).length <= 10) { //返回中文的个数 $.dialog.tips("帖
//判断字符串是不是中文String.prototype.isChinese = function () { var reg = /[^\x00-\xff]/ig;//判断是否存在中文和全角字符// var reg=/[A-Za-z]*[a-z0-9_-]|\s$/;//判断是否包含数字字母下划线 当使用这个时如果只有部分是中文字符还可以使用英文字体 if (reg.test(this)) { return true;//存在中文 } return
str.isnumeric(): True if 只包含数字:otherwise False.注意:此函数只能用于unicode string str.isdigit(): True if 只包含数字:otherwise False. str.isalpha():True if 只包含字母:otherwise False. str.isalnum():True if 只包含字母或者数字:otherwise False.
步骤如下: 1.打开VBA(ALT+F11)2.右键模块=>插入=>模块3.粘贴以下代码: Public Function CutStr(chkStr As String) As String'截取字符串中第一个数字符 Dim i As Long For i = 1 To Len(chkStr) If Mid(chkStr, i, 1) Like "[0-9]" Then CutStr = Mid(chkStr, i, 1) Exit Function End If Nex