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 180 views
1 answer 124 views
1 answer 135 views
2 answers 291 views
1 answer 165 views
...