| if instr(request("id")," ")>0 or instr(request("id"),"'")>0 then response.redirect "index.asp" |
| instr([start, ]string1, string2[, compare]) |
| 參數(shù) | 描述 |
| start | 可選。數(shù)值表達式,用于設(shè)置每次搜索的開始位置。如果省略,將從第一個字符的位置開始搜索。如果 start 包含 null,則會出現(xiàn)錯誤。如果已指定 compare,則必須要有 start 參數(shù)。 |
| string1 | 必選。接受搜索的字符串表達式。 |
| string2 | 必選。要搜索的字符串表達式。 |
| compare | 可選。指示在計算子字符串時使用的比較類型的數(shù)值。有關(guān)數(shù)值,請參閱"設(shè)置"部分。如果省略,將執(zhí)行二進制比較。 compare 參數(shù)可以有以下值: 常數(shù) 值 描述 vbbinarycompare 0 執(zhí)行二進制比較。 vbtextcompare 1 執(zhí)行文本比較。 |
| dim searchstring, searchchar, mypos searchstring ="xxpxxpxxpxxp" ' 要在其中搜索的字符串。 searchchar = "p" ' 搜索 "p"。 mypos = instr(4, searchstring, searchchar, 1) '文本比較從第四個字符開始返回 6。 mypos = instr(1, searchstring, searchchar, 0) '二進制比較從第1個字符開始返回 9。 mypos = instr(searchstring, searchchar) ' 返回 9。 ' 缺省為二進制比較(最后一個參數(shù)省略)。 mypos = instr(1, searchstring, "w") ' 二進制比較從第1個字符開始返回 0 (沒有找到 "w")。 |
| if instr(request("id")," ")>0 or instr(request("id"),"'")>0 then |
新聞熱點
疑難解答
圖片精選