「VB.NET」StringのConcatメソッドで文字列を結合するサンプル

関数
Public Shared Function Concat (str0 As String, str1 As String) As String
str0 連結する最初の文字列。
str1 連結する 2 番目の文字列。
戻り値 指定した 2 つの String インスタンスを連結します。str0 と str1 の連結。
指定された文字列を文字列の最後に連結します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Module Module1
Sub Main()
'文字列型
Dim strA As String = "study"
Dim strB As String = " skill"
Console.WriteLine("結果1: " & String.Concat(strA, strB))
Dim strC As String = " become smart"
Console.WriteLine("結果2: " & String.Concat(strA, strB, strC))
Console.ReadKey()
End Sub
End Module
Module Module1 Sub Main() '文字列型 Dim strA As String = "study" Dim strB As String = " skill" Console.WriteLine("結果1: " & String.Concat(strA, strB)) Dim strC As String = " become smart" Console.WriteLine("結果2: " & String.Concat(strA, strB, strC)) Console.ReadKey() End Sub End Module
Module Module1

    Sub Main()
        '文字列型
        Dim strA As String = "study"
        Dim strB As String = " skill"

        Console.WriteLine("結果1: " & String.Concat(strA, strB))

        Dim strC As String = " become smart"

        Console.WriteLine("結果2: " & String.Concat(strA, strB, strC))

        Console.ReadKey()

    End Sub

End Module

実行結果
結果1: study skill
結果2: study skill become smart

VB.net

Posted by arkgame