Convert string to a string array

  • Thread starter Thread starter Andrew Banks
  • Start date Start date
A

Andrew Banks

I've currently got a string formatted as values;

string MyString = "value1;value2;value3;value4;"

How would I split this and place the values into a string array called
MyStringArray so I could access them as

MyStringArray[0] (would give value1)
MyStringArray[1] (would give value2)
etc......

Thanks in advance
 
You would create a new array using the Split method of the string class.

string[] MyStringArray = MyString.Split(';');

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
Thanks Mark

Mark Fitzpatrick said:
You would create a new array using the Split method of the string class.

string[] MyStringArray = MyString.Split(';');

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

Andrew Banks said:
I've currently got a string formatted as values;

string MyString = "value1;value2;value3;value4;"

How would I split this and place the values into a string array called
MyStringArray so I could access them as

MyStringArray[0] (would give value1)
MyStringArray[1] (would give value2)
etc......

Thanks in advance
 
Back
Top