「VB.net」正規表現で区切り文字を指定する
書式
Regex.Split(文字列,正規表現)
使用例
Imports System.Text.RegularExpressions
Module Module1
Sub Main()
' 変数の宣言
Dim target As String = "test+23_csv+56_de"
'+または_正規表現
Dim res() As String = Regex.Split(target, "[+_]")
'配列の要素を取り出す
For Each ele In res
Console.WriteLine(ele)
Next
Console.WriteLine(res.Length)
Console.ReadKey()
End Sub
End Module
結果
test
23
csv
56
de
5