Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim SearchString, SearchChar As String
Dim MyPos As Integer
SearchString = "XXpXXpXXPXXP" ' String to search in.
SearchChar = "P" ' Search for "P".
MyPos = InStr(SearchString, SearchChar) ' Returns 9.
Response.Write(MyPos & "
")
End Sub
Would you mind explanning how to use "InStr" from the above code? I don't know how to read it. I have tried using the debug tool and find the .NET framework document(library). But I don't know how to use it as well. thx your help.
Also .Net framework as inbuild function String.IndexOf. That also does same purpose I guess, As that's part of CLS, I woudl suggest you to use that in future! @
String.IndexOf Hope it helps!
icarus
Member
205 Points
41 Posts
What is "InStr" method?
Oct 04, 2004 02:25 AM|LINK
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim SearchString, SearchChar As String Dim MyPos As Integer SearchString = "XXpXXpXXPXXP" ' String to search in. SearchChar = "P" ' Search for "P". MyPos = InStr(SearchString, SearchChar) ' Returns 9. Response.Write(MyPos & "Would you mind explanning how to use "InStr" from the above code? I don't know how to read it. I have tried using the debug tool and find the .NET framework document(library). But I don't know how to use it as well. thx your help.") End Sub
JimmyM
Star
8796 Points
1671 Posts
Re: What is "InStr" method?
Oct 04, 2004 03:31 AM|LINK
SreedharK
All-Star
18571 Points
3119 Posts
MVP
Re: What is "InStr" method?
Oct 04, 2004 11:16 AM|LINK
http://www.w3coder.org
weblog http://weblogs.asp.net/skoganti