Codefixer - ASP tutorials, resources and software
asp.netPRO “Best ASP.NET Host” – DiscountASP.NET
Home   Articles   Resources   ASP directory   ASP Tutorials   Code Snippets   ASP Applications   Forum
Tuesday 13 May
MembersPro PayPal - ASP Membership software

ASP.NET 3.5 Hosting – DiscountASP.NET


ASP Partner ASP Partner ASP Partner more partners...

InStr VBScript Function

Syntax: InStr(StringToSearch, StringToFind)
The Function will return the position of the first occurence of StringToFind within StringToSearch. The Function will return 0 if StringToFind is not found.

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:
2

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:
6


Other useful VBScript functions for Parsing String

LinksPro - Directory  and Link  Management Software




ASP.NET 3.5/2.0 Web Hosting: 3 Months FREE – Click Here!




About | Contact | Advertise | Feedback | Hire Us | Link

Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.

Do you intend to move to ASP.NET or have you already?
Yes will do
Have done
ASP does fine
Not a priority


Directory Software