Comma delimited string to array
C# Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | class Program { static void Main(string[] args) { //this line create a comma delimited/separated string. string plants = "Yellow Daisy,Poorland Daisy,Gloriosa Daisy,Brown Daisy,Dindle"; Console.WriteLine(plants); //this line split string by comma and create string array. string[] splittedArray = plants.Split(','); Console.WriteLine("\nstring splitted string array elements......"); Array.ForEach(splittedArray, Console.WriteLine); Console.ReadLine(); } } |
Output:
1 2 3 4 5 6 7 8 9 10 | Yellow Daisy,Poorland Daisy,Gloriosa Daisy,Brown Daisy,Dindle string splitted string array elements...... Yellow Daisy Poorland Daisy Gloriosa Daisy Brown Daisy Dindle |