Instr function returns the position where one string begins within another string : String Function « Data Type « VBA / Excel / Access / Word






Instr function returns the position where one string begins within another string

 
Sub InstrExample()
  Debug.Print InStr("A Balter", "Balter") 'Returns 8
  Debug.Print InStr("Hello", "l") 'Returns 3
  Debug.Print InStr("c:\my documents\my file.txt", "\") 'Returns 3
End Sub

 








Related examples in the same category

1.Format() Formats strings, dates, and numbers as specified.
2.InStrRev begins searching at the end of a string and returns the position where one string is found within another string:
3.Left(string, length) returns the specified number of characters from the left end of a string
4.Right(string, length) returns a specified number of characters from the right end of a string
5.Mid(string, start[, length]) returns the specified number of characters from inside the given string
6.UCase returns a string that is all uppercase
7.InStr() Returns the location of the first character of a substring within another string.
8.InStr(): A number representing the place value of a particular character within a string
9.Using LTrim, RTrim, and Trim to Trim Spaces from a String
10.Len() Returns the number of characters in a string.
11.Len() return the number of characters in a string
12.LCase() Converts the string to lowercase.
13.UCase() Converts the string to uppercase.
14.StrReverse() Reverses the order of the characters in a string.