Examples: InStr function

' The value 5 (the position of the character where the first 
' occurrence of LittleString begins in BigString) is assigned 
' to the variable positionOfChar.
Const CaseAndPitch = 0
Const PitchNoCase = 1
Const CaseNoPitch = 4
Const NoCaseNoPitch = 5

' The value 5 (the position of the character where the first 
' occurrence of LittleString begins in BigString) is assigned 
' to the variable positionOfChar.

Dim BigString As String, LittleString As String
Dim positionOfChar As Long

BigString$ = "abcdefghi"
LittleString$ = "efg"

positionOfChar& = InStr(BigString$, LittleString$)
Print positionOfChar& ' Output:  5

positionOfChar& = InStr(1, BigString$, LittleString$)
Print positionOfChar& ' Output:  5

positionOfChar& = InStr(1, BigString$, LittleString$, NoCaseNoPitch)
Print positionOfChar& ' Output:  5