如何遍历VB.NET中的连接字符串?

时间:2011-01-17 13:50:03

标签: vb.net

我有一个像

这样的连接字符串
str = 1010,5050,6079

我想分开字符串。在JavaScript中,我可以做到

string = Srt.split(","):

并获得结果

string[2]=5050

有没有办法在VB.NET中执行此操作?

2 个答案:

答案 0 :(得分:2)

它在VB.NET中的工作方式相同

Dim input As String = "1010,5050,6079"
Dim result As String() = input.Split(",")

result(0) //contains 1010
result(1) //contains 5050
result(2) //contains 6079

答案 1 :(得分:0)

没有区别。尝试使用VB.NET中的相同代码:

Dim shoppingList As String = "Milk,Eggs,Bread"  
Dim shoppingItem(3) As String  
shoppingItem = shoppingList.Split(",")