In many applications, it is necessary to search for a character or set of characters in a String. For example, a programmer creating a word processor would want to provide capabilities for searching through documents. Figure 16.5 demonstrates some of the many versions of String methods IndexOf, IndexOfAny, LastIndexOf and LastIndexOfAny, which search for a specified character or substring in a String. This example searches the String letters which is initialized with "abcdefghijklmabcdefghijklm" (line 6).
1 ' Fig. 16.5: StringIndexMethods.vb 2 ' Using String searching methods. 3 4 Module StringIndexMethods 5 Sub Main() 6 Dim ...