当前位置: 动力学知识库 > 问答 > 编程问答 >

How to traverse a concatenated string in VB.NET?

问题描述:

I have a concatenated string like

str = 1010,5050,6079

I want to separate the string. In JavaScript, I can do

string = Srt.split(","):

and get the result

string[2]=5050

Is there a way to do this in VB.NET?

网友答案:

It works the same in 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
网友答案:

There is no diference. Try with the same code in VB.NET:

Dim shoppingList As String = "Milk,Eggs,Bread"  
Dim shoppingItem(3) As String  
shoppingItem = shoppingList.Split(",")
分享给朋友:
您可能感兴趣的文章:
随机阅读: