Remove Commas in a string and insert each comma-separated value into a string
How would I do this?
To bring it into some better context, I'm having a value from an XML attribute开发者_JAVA技巧 and I want each individual value to be added to an array of strings and each of those values is separated by commas
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);
}
string input = Console.ReadLine();
char splitter = ',' ;
string[] output = input.Split(splitter);
foreach (string t in output)
{
Console.WriteLine(t);
}
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?
精彩评论