我对Vb.net很新,并且已经找到了如何拆分字符串并将拆分字符串的残余部分放在一个数组中......
Dim str As String
Dim strArr() As String
Dim count As Integer
str = "vb.net split test"
strArr = str.Split(" ")
For count = 0 To strArr.Length - 1
MsgBox(strArr(count))
Next
输出:
vb.net
split
test
现在我已经明白了,我想知道是否有一种方法可以分割出SECOND空间给出输出......
vb.net split
test
谢谢你的时间!
答案 0 :(得分:2)
你可以做这样的事情
Dim input = "This is a Long String"
Dim splitted = input.Split(" "c)
Dim result = New List(Of String)()
For x As Integer = 0 To splitted.Length - 1 Step 2
result.Add(String.Join(" ", splitted.Skip(x).Take(2)))
Next