VB.NET 任意の区切り文字のある文字列を配列に変換する
VB.NETで任意の区切り文字のある文字列を配列に変換する方法を紹介します。
文字列を配列に変換するにはSplitを使います。文字列.Split(区切り文字)で配列に変換できます。
Dim str As String = "a,b,c,d,e"
Dim arr As String() = str.Split(","c)
For Each s In arr
Console.WriteLine(s)
Next
'出力結果
'a
'b
'c
'd
'e区切り文字はCharで指定する必要があるので区切り文字のあとにcを追加します。