June 2006
Intermediate to advanced
1344 pages
42h 52m
English
Like the & operator, the String class’s Shared method Concat (Fig. 16.7) can be used to concatenate two Strings. The method returns a new String containing the combined characters from both original Strings. Line 13 appends the characters from string2 to the end of a copy of string1, using method Concat. The original Strings are not modified.
1 ' Fig. 16.7: SubConcatenation.vb 2 ' Demonstrating String class Concat method. 3 4 Module StringConcatenation 5 Sub Main() 6 Dim string1 As String = "Happy " 7 Dim string2 As String = "Birthday" 8 9 Console.WriteLine("string1 = """ & string1 & """" & _ 10 vbCrLf & "string2 = """ & string2 & """") 11 Console.WriteLine(vbCrLf & _ 12 "Result ... |
Read now
Unlock full access