InStr Function


InStr Function

Class

Microsoft.VisualBasic.Strings

Syntax

     Dim result As Integer = InStr([start, ]string1, string2[, compare]) 


start (optional; Integer)

The 1-based starting position for the search. If omitted, 1 is used.


string1 (required; String)

The string being searched.


string2 (required; String)

The substring to be found within string2.


compare (optional; CompareMethod enumeration)

The type of string comparison. One of the following Microsoft.VisualBasic.CompareMethod enumeration values.

Value

Description

Binary

Performs a binary (case-sensitive) comparison

Text

Performs a text (case-insensitive) comparison


If omitted, the setting specified through the Option Compare statement is used.

Description

The InStr function finds the 1-based starting position of string2 within string1, optionally skipping the first few characters. If a match is not found, zero is returned.

Usage at a Glance

If string2 is empty or Nothing, the value of start is returned.

See Also

InStrRev Function




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net