Convert string to a string array

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
 
M

Mark Fitzpatrick

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
 
A

Andrew Banks

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top