Microsoft KB Archive/61960

{|
 * width="100%"|

WordBASIC InStr Function Is Case Sensitive

 * }

Q61960

-

The information in this article applies to:


 * Microsoft Word for Windows, versions 1.0, 1.1, 1.1a, 2.0, 2.0a, 2.0a-CD, 2.0b, 2.0c, 6.0, 6.0a, 6.0c

-

SUMMARY
The WordBASIC InStr function is case sensitive. For example, a search for the string &quot;Test String&quot;, as in

  N = InStr(A$, &quot;Test String&quot;) returns a valid position number only if the string &quot;Test String&quot; is present in A$. &quot;TEST STRING&quot; and &quot;test string&quot; are not found by the InStr function.

To work around this problem, use one of the following:

  N = InStr(LCase$(A$), &quot;test string&quot;) "-or-"   N = InStr(UCase$(A$), &quot;TEST STRING&quot;) The LCase$ and UCase$ functions return their arguments (in this case, the text of A$) in either lowercase text or uppercase text respectively, without modifying the original string. As a result, either method is effective for case-insensitive text searches.

Additional query words:

Keywords : kbmacro winword word6 winword2 kbofficeprog

Issue type :

Technology :