If instr(Request("id")," ")>0 or instr(Request("id"),"'")>0 then response.redirect "index.asp" |
InStr([start, ]string1, string2[, compare]) |
參數 | 描述 |
start | 可選。數值表達式,用于設置每次搜索的開始位置。如果省略,將從第一個字符的位置開始搜索。如果 start 包含 Null,則會出現錯誤。如果已指定 compare,則必須要有 start 參數。 |
String1 | 必選。接受搜索的字符串表達式。 |
String2 | 必選。要搜索的字符串表達式。 |
Compare | 可選。指示在計算子字符串時使用的比較類型的數值。有關數值,請參閱"設置"部分。如果省略,將執行二進制比較。 compare 參數可以有以下值: 常數 值 描述 vbBinaryCompare 0 執行二進制比較。 vbTextCompare 1 執行文本比較。 |
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。 ' 缺省為二進制比較(最后一個參數省略)。 MyPos = Instr(1, SearchString, "W") ' 二進制比較從第1個字符開始返回 0 (沒有找到 "W")。 |
if instr(Request("id")," ")>0 or instr(Request("id"),"'")>0 then |
新聞熱點
疑難解答