我想检查地址是否以asp中的
http://www.youtube.com开头.
如果我有这样的事情
if rs("mainVideoName")="http://www.youtube.com*" then
这不起作用,我该怎么办呢?
谢谢!
解决方法
试试这个:
Function UrlStartsWith(string1,string2) UrlStartsWith = InStr(1,string1,string2,1) = 1 End Function If UrlStartsWith(rs("mainVideoName"),"http://www.youtube.com") Then End If
通过使用IntStr测试开始并确保它返回1作为找到搜索字符串的起始位置.由于您正在测试URL,因此上面的代码使用TextCompare对case进行不敏感.