基本校验参考Public Function fnIsURL(strURL As String, _
Optional strRtnNetURL As String, Optional IsRootPath As Boolean, _
Optional IsWebURL As Boolean, Optional Protocol As String, _
Optional IsConvertPathDelimeter As Boolean, _
Optional PathDelimeter As String) As Boolean
Dim pos As Long
fnIsURL = True
If InExists(strURL, "http:///", 1, pos) Then
Protocol = "http:///"
IsWebURL = False
fnIsURL = False
ElseIf InExists(strURL, "http://", 1, pos) Then
Protocol = "http://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 7)
ElseIf InExists(strURL, "ftp://", 1, pos) Then
Protocol = "ftp://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 6)
ElseIf InExists(strURL, "pnm://", 1, pos) Then
Protocol = "pnm://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 6)
ElseIf InExists(strURL, "mms://", 1, pos) Then
Protocol = "mms://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 6)
ElseIf InExists(strURL, "rtsp://", 1, pos) Then
Protocol = "rtsp://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 7)
ElseIf InExists(strURL, "file:///", 1, pos) Then
' Protocol = "file:///"
IsWebURL = IIf(pos = 1, False, True)
If Not IsWebURL Then strRtnNetURL = Mid(strURL, pos + 8)
ElseIf InExists(strURL, "file://", 1, pos) Then
' Protocol = "file://"
IsWebURL = IIf(pos = 1, False, True)
If Not IsWebURL Then strRtnNetURL = Mid(strURL, pos + 7)
ElseIf InExists(strURL, "file:", 1, pos) Then
' Protocol = "file:"
IsWebURL = IIf(pos = 1, False, True)
If Not IsWebURL Then strRtnNetURL = Mid(strURL, pos + 5)
ElseIf Len(strURL) >= 3 Then
IsWebURL = False
If InExists(fnGetDriveString, Left(strURL, 3)) Then
strRtnNetURL = strURL
Else
fnIsURL = False
End If
Else
IsWebURL = False
fnIsURL = False
End If
If fnIsURL Then
If Len(PathDelimeter) = 0 Then PathDelimeter = IIf(IsWebURL, "/", "\")
strRtnNetURL = Replace(strRtnNetURL, "?", PathDelimeter)
strRtnNetURL = ReplaceSCharsInURL(strRtnNetURL)
If IsConvertPathDelimeter Then
strRtnNetURL = Replace(strRtnNetURL, "/", PathDelimeter)
strRtnNetURL = Replace(strRtnNetURL, "\", PathDelimeter)
ElseIf Not IsWebURL Then
strRtnNetURL = Replace(strRtnNetURL, "/", PathDelimeter)
End If
If InCount(strRtnNetURL, PathDelimeter) = 0 Then
IsRootPath = True
ElseIf InCount(strRtnNetURL, PathDelimeter) = 1 Then
If Right(strRtnNetURL, 1) = PathDelimeter Then IsRootPath = True
End If
End If
End FunctionFunction InExists(ByVal Source As Variant, ByVal Target As String, _
Optional ByVal Compare As Integer = CASE_INSENSITIVE, _
Optional Return_pos As Long) As Boolean
Return_pos = InStr(1, Source, Target, Compare)
InExists = (Return_pos > 0)
End Function
Optional strRtnNetURL As String, Optional IsRootPath As Boolean, _
Optional IsWebURL As Boolean, Optional Protocol As String, _
Optional IsConvertPathDelimeter As Boolean, _
Optional PathDelimeter As String) As Boolean
Dim pos As Long
fnIsURL = True
If InExists(strURL, "http:///", 1, pos) Then
Protocol = "http:///"
IsWebURL = False
fnIsURL = False
ElseIf InExists(strURL, "http://", 1, pos) Then
Protocol = "http://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 7)
ElseIf InExists(strURL, "ftp://", 1, pos) Then
Protocol = "ftp://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 6)
ElseIf InExists(strURL, "pnm://", 1, pos) Then
Protocol = "pnm://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 6)
ElseIf InExists(strURL, "mms://", 1, pos) Then
Protocol = "mms://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 6)
ElseIf InExists(strURL, "rtsp://", 1, pos) Then
Protocol = "rtsp://"
IsWebURL = IIf(pos = 1, True, False)
If IsWebURL Then strRtnNetURL = Mid(strURL, pos + 7)
ElseIf InExists(strURL, "file:///", 1, pos) Then
' Protocol = "file:///"
IsWebURL = IIf(pos = 1, False, True)
If Not IsWebURL Then strRtnNetURL = Mid(strURL, pos + 8)
ElseIf InExists(strURL, "file://", 1, pos) Then
' Protocol = "file://"
IsWebURL = IIf(pos = 1, False, True)
If Not IsWebURL Then strRtnNetURL = Mid(strURL, pos + 7)
ElseIf InExists(strURL, "file:", 1, pos) Then
' Protocol = "file:"
IsWebURL = IIf(pos = 1, False, True)
If Not IsWebURL Then strRtnNetURL = Mid(strURL, pos + 5)
ElseIf Len(strURL) >= 3 Then
IsWebURL = False
If InExists(fnGetDriveString, Left(strURL, 3)) Then
strRtnNetURL = strURL
Else
fnIsURL = False
End If
Else
IsWebURL = False
fnIsURL = False
End If
If fnIsURL Then
If Len(PathDelimeter) = 0 Then PathDelimeter = IIf(IsWebURL, "/", "\")
strRtnNetURL = Replace(strRtnNetURL, "?", PathDelimeter)
strRtnNetURL = ReplaceSCharsInURL(strRtnNetURL)
If IsConvertPathDelimeter Then
strRtnNetURL = Replace(strRtnNetURL, "/", PathDelimeter)
strRtnNetURL = Replace(strRtnNetURL, "\", PathDelimeter)
ElseIf Not IsWebURL Then
strRtnNetURL = Replace(strRtnNetURL, "/", PathDelimeter)
End If
If InCount(strRtnNetURL, PathDelimeter) = 0 Then
IsRootPath = True
ElseIf InCount(strRtnNetURL, PathDelimeter) = 1 Then
If Right(strRtnNetURL, 1) = PathDelimeter Then IsRootPath = True
End If
End If
End FunctionFunction InExists(ByVal Source As Variant, ByVal Target As String, _
Optional ByVal Compare As Integer = CASE_INSENSITIVE, _
Optional Return_pos As Long) As Boolean
Return_pos = InStr(1, Source, Target, Compare)
InExists = (Return_pos > 0)
End Function
解决方案 »
- VB串口通讯报错
- 如何实现商品名称自动形成拼音码和五笔码?
- vb中有没有类似C语言Express?True:False的判断语法?
- 真是奇了,这是如何做的?在设计时,表单上的控件竟然不能拖动,只能用键盘移动!
- 我需要一个VB写的局域网传输文件原代码,传输速度要快的
- 如果用matlab跟vb合作,跟与delphi相比,那个跟好一点,五天积分
- 如何作一个IE地址栏那样的输入字符后自动列出类似的字符来!拜托各位了
- 那位大哥 :帮我 如何使gif 图动起来
- vb 有在“北京思元软件有限公司 ”工作或工作过的吗,这公司怎么样
- 请问下,vb+mysql 如何使用排名,然后调取所有排名数据??
- 因我用PICTUREBOX控件做动态影像采集显示用,但需要采集的动态图象是可旋转
- 2各位谁有完整的ANSI转义字符列表
可以开1000个线程同时验证!!