asp验证Ip格式的函数

发布时间:2022-04-17 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了asp验证Ip格式的函数脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
验证Ip格式<%
'******************************
'函数:CheckIp(paR_strIp)
'参数:str&nbsp;要检测的字符串
'作者:阿里西西
'日期:2007/7/13
'描述:验证Ip格式,是返回1,否则返回0
'示例:<%=CheckIp("219.45.23.11")%>
'******************************
Function CheckIp(paR_strIp)
   CheckIp =0
   Dim tmpLoop, tmpStr
   tmpStr =paR_strIp
   If tmpStr ="" Or IsNull(tmpStr) Then ExIT Function
   tmpStr =Split(tmpStr, ".")
   If Not isArray(tmpStr) Then Exit Function

   For tmpLoop =0 To ubound(tmpStr)
      If tmpStr(tmpLoop) ="" Or IsNull(tmpStr(tmpLoop)) Then Exit Function
      If Not isNumeric(tmpStr(tmpLoop)) Then Exit Function
      If Cint(tmpStr(tmpLoop)) >255 Or Cint(tmpStr(tmpLoop)) <1 Then Exit Function
   Next
   CheckIp =1
End Function
%>

脚本宝典总结

以上是脚本宝典为你收集整理的asp验证Ip格式的函数全部内容,希望文章能够帮你解决asp验证Ip格式的函数所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: