How to split string by space into words in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        string str = "C# is a general purpose programming language";

        string [] arr = str.Split(' ');
            
        foreach (string s in arr) {
           Console.WriteLine(s);
       }
    }
}




/*
run:
           
C#
is
a
general
purpose
programming
language
           
*/

 



answered Sep 4, 2021 by avibootz

Related questions

1 answer 238 views
1 answer 297 views
297 views asked Jul 17, 2020 by avibootz
3 answers 399 views
1 answer 241 views
1 answer 229 views
1 answer 265 views
1 answer 260 views
...