Thursday, 19 June 2014

Instr Function:-The InStr function will returns the numeric position of the first occurrence of a specified substring within a specified string when starting from the beginning (left end) of the string

Syntax:-
InStr(Start, String, Substring, Compare(optional))

The InStr function will returns the numeric position of the first occurrence of a specified substring within a specified string when starting from the beginning (left end) of the string. You can have the search for the substring be sensitive to the case (upper versus lower), or not. The default is to be case sensitive (binary comparison).
Example:-

str="Velmurugan"
str1="m"

a=instr(1,str,str1,1)
msgbox a

output:-4

Here Start is nothing but to start search from which position , if start is 1 means it will search from 1st position , if start is 5 means it will search from 5th position of string.

Note:-

Compare VALUEDESCRIPTION
0Binary comparison(case sensitive)
1Text Comparison(case insensitive)
2Compare information inside database


 

No comments:

Post a Comment