How do I split a comma separated string?

后端 未结 2 669
耶瑟儿~
耶瑟儿~ 2021-01-23 11:47

I have a comma separated string.

e.g. {\"one,two,three\"} 

Can anyone please tell me if I can create an array from this and if so, how? in VB.

2条回答
  •  不要未来只要你来
    2021-01-23 12:29

        ' 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
    

提交回复
热议问题