How to get comma separated string into an array in C#

1 Answer

0 votes
using System;

public class Program
{
    public static void Main(string[] args)
    {
        string str = "java,c,c++,python,c#";
        
        string[] stringArray = str.Split(',');

        Array.ForEach(stringArray, s => Console.WriteLine(s));
    }
}

 
/*
run:
   
java
c
c++
python
c#
   
*/

 



answered Jun 4, 2024 by avibootz

Related questions

1 answer 138 views
1 answer 69 views
1 answer 88 views
2 answers 188 views
1 answer 131 views
...