views:

107

answers:

3

is instr used in vb.net for this?

+2  A: 

no indexof is

Fredou
-1 for the "no" because Instr **is** available and used in VB.Net, so the answer is wrong as it stands.
MarkJ
@MarkJ, problem with instr, it doesn't know when it's an empty string and when the position is found at index 0, both return 0 and you need to handle null.
Fredou
+3  A: 

Use String.IndexOf

http://msdn.microsoft.com/en-us/library/system.string.indexof.aspx

AcousticBoom
+1  A: 

You can use the IndexOf method on a string, and you can also use the VB InStr function if you wish, although I would suggest sticking to .NET specific functions.

I would also suggest that you take a look at the documentation of the String methods which will help you know what functionality is available in the framework when working with strings. You can also take a look at the documentation for VB-specific string functions.

Meta-Knight
The pros and cons of the VB-specific functions like Instr are discussed in other questions. http://stackoverflow.com/questions/tagged/microsoft.visualbasic
MarkJ