Splitting a string on comma and printing the results

前端 未结 3 761
我在风中等你
我在风中等你 2021-01-19 11:39

I am using the following code to split a string and retrieve them:

Private Sub Button1_Click(sender As Object, e As EventArgs) 
      Handles Button1.Click
          


        
3条回答
  •  有刺的猬
    2021-01-19 12:12

    It is not clear from your question, but if you want only the first word in your array of strings then no need to loop over it

     Dim firstWord = parts(0)
     Console.WriteLine(firstWord) ' Should print `a` from your text sample
    
     ' or simply
     Console.WriteLine(parts(0)) 
    
     ' and the second word is     
     Console.WriteLine(parts(1))  ' prints `bc`
    

提交回复
热议问题