O'Reilly logo

Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16.6. Locating Characters and Substrings in Strings

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).

Figure 16.5. Searching for characters and substrings in Strings.
					1
					' Fig. 16.5: StringIndexMethods.vb
					2
					' Using String searching methods.
					3
					4
					Module StringIndexMethods
 5
					Sub Main()
 6
					Dim ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required