how to devide string to array?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi any body,
how to devide some string like "aaa,bbb,ccc,ddd" to a string array? Is there
have any vb function to do that?

thanks.
 
xuts said:
hi any body,
how to devide some string like "aaa,bbb,ccc,ddd" to a string array? Is there
have any vb function to do that?

Dim input As String = "aaa,bbb,ccc,ddd"
input.Split(","c)

This will give you an array an array of four strings: "aaa", "bbb",
"ccc", and "ddd"
 
xuts said:
hi any body,
how to devide some string like "aaa,bbb,ccc,ddd" to a string array? Is
there
have any vb function to do that?

thanks.

Dim sInput As String = "aaa,bbb,ccc,ddd"
Dim aArray()
sArray = sInput.Split(",")

Now, sArray(0) will contain "aaa", sArray(1) will contain "bbb", etc.

Cheers.
 
Check out the split function

i.e.

' This will split the string on the comma character
Dim str As String = "aaa,bbb,ccc,ddd"
Dim arr() As String = str.Split(",")

Thanks,

Seth Rowe
 
Back
Top