InStr

Top  Previous  Next

function InStr(Source As String, SearchStr As String) As Integer

 

' -or-

 

function Pos(SearchStr As String, Source As String) As Integer

 

Returns an integer specifying the start position of the first occurrence of one string within another.

 

InStr is case-sensitive. The first character in Source has the position 1. If SearchStr is not found, InStr returns zero.

 

Parameters

 

SearchStr ... String expression being searched.
Source ... String expression sought.

 

Example:

Dim s, i

 

= "This is a text"

= InStr(s, "is")

' returns i = 6




Translate document: