views:

80

answers:

3

How would I do this?

To bring it into some better context, I'm having a value from an XML attribute and I want each individual value to be added to an array of strings and each of those values is separated by commas

+2  A: 

Is string.Split what you're after? It's not entirely obvious from your question.

string text = "a,b,c";
string[] bits = text.Split(',');

foreach (string bit in bits)
{
    Console.WriteLine(bit);
}
Jon Skeet
Sounds like the data is simple enough that this will work; if it's full CSV including escapes then it needs to be rethought.
phasetwenty
A: 

how are these values stored in the xml? If you know the structure of the xml you can easily extract the info..i din quite get the next part. you want to make a CSV but u also want to store it in an array.but wont the array itself seperate the values?

Ram Bhat
+1  A: 
        string input = Console.ReadLine();
        char splitter = ',' ;
        string[] output = input.Split(splitter);
        foreach (string t in output)
        {
            Console.WriteLine(t);
        }
Ronzii