当前位置: 移动技术网 > IT编程>开发语言>Asp > asp验证Ip格式的函数

asp验证Ip格式的函数

2017年12月12日  | 移动技术网IT编程  | 我要评论
验证ip格式<% '****************************** '函数:checkip(par_strip) '参数:str 要检测的字符
验证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
%>

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网