InStr

Return the position of the first occurrence of one string within another.

Syntax 
      InStr([start, ]string1, string2[, compare])

Key
   string1        The initial string of Text
   string2        The text we want to find in String1
   Start          Character position in string1 at which to start the search
   Compare        Either vbBinaryCompare or VBTextCompare

Example

result = InStr("Hello World", "wor")
WScript.Echo result

“Who looks outside, dreams; who looks inside, awakes” ~ Carl Gustav Jung

Related:

InStrRev - Find one string within another, starting from the end
Replace - Find and replace text
Equivalent in PowerShell: $result = $myvar.indexof("demo") Also .contains("demo") returns True/False


 
Copyright © SS64.com 1999-2019
Some rights reserved