分页类,异常类(6)
Private Sub Class_initialize()
Set Reg = New RegExp
Reg.Global = True
End Sub
Private Sub Class_Terminate()
Set Reg = Nothing
End Sub Public Sub Rlen(ByRef Str, ByRef Rl)
With Reg
.Pattern = "[^\x00-\xFF]"
Rl = Len(.Replace(Str, ".."))
End With
End Sub End Class
%>
<%
Dim Util : Set Util = New Utility
%> 输入验证类Validator:
<%@Language="VBScript" CodePage="936"%>
<%
'Option Explicit
Class Validator
'*************************************************
' Validator for ASP beta 3 服务器端脚本
' code by 我佛山人
' wfsr@cunite.com
'*************************************************
Private Re
Private ICodeName
Private ICodeSessionName Public Property Let CodeName(ByVal PCodeName)
ICodeName = PCodeName
End Property Public Property Get CodeName()
CodeName = ICodeName
End Property Public Property Let CodeSessionName(ByVal PCodeSessionName)
ICodeSessionName = PCodeSessionName
End Property Public Property Get CodeSessionName()
CodeSessionName = ICodeSessionName
End Property Private Sub Class_Initialize()
Set Re = New RegExp
Re.IgnoreCase = True
Re.Global = True
Me.CodeName = "vCode"
Me.CodeSessionName = "vCode"
End Sub Private Sub Class_Terminate()
Set Re = Nothing
End Sub Public Function IsEmail(ByVal Str)
IsEmail = Test("^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$", Str)
End Function Public Function IsUrl(ByVal Str)
IsUrl = Test("^http:\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\':+!]*([^<>""])*$", Str)
End Function Public Function IsNum(ByVal Str)
IsNum= Test("^\d+$", Str)
End Function Public Function IsQQ(ByVal Str)
IsQQ = Test("^[1-9]\d{4,8}$", Str)
End Function Public Function IsZip(ByVal Str)
IsZip = Test("^[1-9]\d{5}$", Str)
End Function Public Function IsIdCard(ByVal Str)
IsIdCard = Test("^\d{15}(\d{2}[A-Za-z0-9])?$", Str)
End Function Public Function IsChinese(ByVal Str)
IsChinese = Test("^[\u0391-\uFFE5]+$", Str)
End Function Public Function IsEnglish(ByVal Str)
IsEnglish = Test("^[A-Za-z]+$", Str)
End Function Public Function IsMobile(ByVal Str)
内容版权声明:除非注明,否则皆为本站原创文章。