VB.Net Tutorial/Data Type/String Concatenate

Материал из VB Эксперт
Версия от 12:54, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

String Concatenate

Option Strict On
 Imports System
 Class Tester
     Public Shared Sub Main( )
         Dim s1 As String = "abcd"
         Dim s2 As String = "ABCD"
         " concatenation method
         Dim s3 As String = String.Concat(s1, s2)
         Console.WriteLine("s3 concatenated from s1 and s2: {0}", s3)
     End Sub "Main
 End Class "Tester
s3 concatenated from s1 and s2: abcdABCD

Use the overloaded operator

Option Strict On
 Imports System
 Class Tester
     Public Shared Sub Main( )
         Dim s1 As String = "abcd"
         Dim s2 As String = "ABCD"
         
         Dim s4 As String = s1 & s2
         Console.WriteLine("s4 concatenated from s1 & s2:"+ s4)
     End Sub "Main
 End Class "Tester
s4 concatenated from s1 & s2: abcdABCD