June 2006
Intermediate to advanced
1344 pages
42h 52m
English
Class String provides two Substring methods, which are used to create a new String by copying part of an existing String. Each method returns a new String. Figure 16.6 demonstrates both methods.
1 ' Fig. 16.6: SubString.vb 2 ' Demonstrating the String Substring method. 3 4 Module SubString 5 Sub Main() 6 Dim letters As String = "abcdefghijklmabcdefghijklm" 7 Dim output As String = "" 8 9 ' invoke Substring method and pass it one parameter 10 Console.WriteLine("Substring from index 20 to end is """ & _ 11 letters.Substring(20) & """") 12 13 ' invoke Substring method and pass it two parameters 14 Console.WriteLine("Substring from index 0 of length 6 is """ ... |
Read now
Unlock full access