Article ID: 44799 - View products that this article applies to.
This article was previously published under Q44799
The INSTR function (provided in all Microsoft BASICs) compares the ASCII values of the search string with the ASCII values of the string to be searched, and is, therefore, case sensitive. For example, when INSTR compares "AB" with "Ab", INSTR returns 0 (zero) because the strings are different.
This information applies to the following products:
The INSTR function returns the character position of the first occurrence of a string in another string. The syntax for INSTR is as follows
INSTR ( [Start,] string1, string2 )where the variables refer to the following:
The values returned by the INSTR function are as follows:
Variable Description Start The [optional] character location to begin searching in string1 string1 The character string to be searched string2 The character string to be searched for
If string2 is a null string (""), then INSTR returns the value of 1 unless a Start argument was specified, in which case it returns a value equal to Start.
Value Description n Refers to the character position of string2 in string1. 0 string2 was not found in string1. 0 string1 is a null string (""). 0 The value for Start is greater than the length of string1.
For more information about the INSTR function, please consult your BASIC language reference manual.
Article ID: 44799 - Last Review: November 21, 2006 - Revision: 1.3
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.