asp验证Ip格式的函数

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

asp验证Ip格式的函数

  2021-03-18 我要评论
想了解asp验证Ip格式的函数的相关内容吗,在本文为您仔细讲解的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:asp验证Ip格式的函数,下面大家一起来学习吧。
验证Ip格式<%
'******************************
'函数:CheckIp(paR_strIp)
'参数:str 要检测的字符串
'作者:阿里西西
'日期: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
%>

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们