ASP常用函数收藏乱七八糟未整理版(4)
fString = Replace(fString, "<", "<")
fString = Replace(fString, Chr(32), " ")
fString = Replace(fString, Chr(9), " ")
fString = Replace(fString, Chr(34), """)
fString = Replace(fString, Chr(39), "'")
fString = Replace(fString, Chr(13), "")
fString = Replace(fString, Chr(10) & Chr(10), "</P><P> ")
fString = Replace(fString, Chr(10), "<BR> ")
HTMLEncode = fString
End If
End Function
' *----------------------------------------------------------------------------
' * 函数:HTMLcode
' * 描述:过滤表单字符
' * 参数:--
' * 返回:--
' * 作者:
' * 日期:
' *----------------------------------------------------------------------------
Function HTMLcode(fString)
If Not IsNull(fString) Then
fString = Replace(fString, Chr(13), "")
fString = Replace(fString, Chr(10) & Chr(10), "</P><P>")
fString = Replace(fString, Chr(34), "")
fString = Replace(fString, Chr(10), "<BR>")
HTMLcode = fString
End If
End Function
%>
<%
1.检查是否有效邮件地址
Function CheckEmail(strEmail)
Dim re
Set re = New RegExp
re.Pattern = "^[w-.]{1,}@([da-zA-Z-]{1,}.){1,}[da-zA-Z-]{2,3}$"
re.IgnoreCase = True
CheckEmail = re.Test(strEmail)
End Function
2.测试变量是否为空值,空值的含义包括:变量不存在 / 为空,对象为Nothing,0,空数组,字符串为空
Function IsBlank(ByRef Var)
IsBlank = False
Select Case True
Case IsObject(Var)
内容版权声明:除非注明,否则皆为本站原创文章。