If instr(Request("id")," ")>0 or instr(Request("id"),"'")>0 then response.redirect "index.asp" |
InStr([start, ]string1, string2[, compare]) |
Parameter | description |
start | is optional. Numeric expression that sets the starting position for each search. If omitted, the search will start at the first character position. If start contains Null, an error occurs. If compare is specified, the start parameter is required. |
String1 | is required. Accepts a string expression to search for. |
String2 | Required. The string expression to search for. |
Compare | is optional. A numeric value indicating the type of comparison used when evaluating substrings. See the "Settings" section for values. If omitted, a binary comparison will be performed. The compare parameter can have the following values: Constant value description vbBinaryCompare 0 Performs a binary comparison. vbTextCompare 1 Performs text comparison. |
Dim SearchString, SearchChar, MyPos SearchString ="XXpXXpXXPXXP" ' The string to search for. SearchChar = "P" ' Search for "P". MyPos = Instr(4, SearchString, SearchChar, 1) 'Text comparison returns 6 starting from the fourth character. MyPos = Instr(1, SearchString, SearchChar, 0) 'Binary comparison returns 9 starting from the 1st character. MyPos = Instr(SearchString, SearchChar) ' Return 9. ' Defaults to binary comparison (last argument omitted). MyPos = Instr(1, SearchString, "W") 'Binary comparison returns 0 starting from character 1 ("W" not found). |
if instr(Request("id")," ")>0 or instr(Request("id"),"'")>0 then |