How to extract all words from a string in C#

1 Answer

0 votes
using System;
 
class Program
{
    static void Main() {
        string s = "c# c++ java c python";
 
        string[] words = s.Split();
 
        foreach(String str in words)
            Console.WriteLine(str);
    }
}
 
 
 
 
/*
run:
 
c#
c++
java
c
python
 
*/

 



answered Feb 9, 2022 by avibootz
...