Bookshelf Home | Contents | Index | PDF |
Siebel VB Language Reference > VB Language Reference > InStr FunctionThis standard VB function returns the position of the first occurrence of one string within another string. Syntax AInStr([start,] string1, string2) Syntax BInStr(start, string1, string2[, compare])
ReturnsThe position of the first character of string2 in string1. UsageIf not specified, the search starts at the beginning of the string (equivalent to a start of 1). These arguments can be of any type. They are converted to strings. InStr returns a zero under the following conditions: If either string1 or string2 is a null variant, Instr returns a null variant. If string2 is a null string (""), Instr returns the value of start. If compare is 0, a case-sensitive comparison based on the ANSI character set sequence is performed. If compare is 1, a case-insensitive comparison is done based upon the relative order of characters as determined by the country code setting for your computer. If compare is omitted, the module level default, as specified with Option Compare, is used. ExampleThis example generates a random string of characters, then uses InStr to find the position of a single character within that string. Sub Button_Click See AlsoLeft Function |
Siebel VB Language Reference |