我有一个逗号分隔的字符串.
e.g. {"one,two,three"}
Run Code Online (Sandbox Code Playgroud)
任何人都可以告诉我,如果我可以从这个创建一个阵列,如果是这样,怎么样?在VB.net中.
Abb*_*ala 15
' you want to split this input string
Dim s As String = "one,two,three"
' Split string based on comma
Dim words As String() = s.Split(New Char() {","c})
' Use For Each loop over words and display them
Dim word As String
For Each word In words
Console.WriteLine(word)
Next
Run Code Online (Sandbox Code Playgroud)
像这样:
dim str as string = "one,two,three"
dim str2() as string = split(str, ",")
Run Code Online (Sandbox Code Playgroud)
参考: