验证IP是否合法的函数(VB)
Public Function IsValidIPAddress(ByVal strIPAddress As String) As Boolean
On Error GoTo Handler
Dim varAddress As Variant, n As Long, lCount As Long
varAddress = Split(strIPAddress, ".", , vbTextCompare)
'//
If IsArray(varAddress) Then
For n = LBound(varAddress) To UBound(varAddress)
lCount = lCount + 1
varAddress(n) = CByte(varAddress(n))
Next
'//
IsValidIPAddress = (lCount = 4)
Else
IsValidIPAddress = False
End If
'//
Handler:
End Function
Tags:
作者:佚名评论内容只代表网友观点,与本站立场无关!
评论摘要(共 0 条,得分 0 分,平均 0 分)
查看完整评论