![]() |
|
|
InStr VBScript FunctionSyntax: InStr(StringToSearch, StringToFind) Example 1: <%
String1="michael" String2="wall" If InStr(String1,String2)>0 Then Response.write("String1 contains String2") Else Response.write("String1 is not in String2") End if %> Example 2: <%
String1="It's taken me 4 years of work" String2="t" Location= Instr(String1,String2) response.write Location %> Result displayed on the screen would be: Note you can set the starting position for each search. If omitted, search begins at the first character position. Example 3: <%
String1="It's taken me 4 years of work" String2="t" Location= Instr(3,String1,String2) response.write Location %> Result displayed on the screen would be: Other useful VBScript functions for Parsing String
Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|