This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string str = "Tom Cruise, Scott, ,Bob | at"; | |
IEnumerable<string> names = str | |
.Split(new char[]{',', '|'}) | |
.Where(x=>x!=null && x.Trim().Length > 0) | |
.Select(x=>x.Trim()); |
Output
Tom
Cruise
Scott
Bob
at
Stackoverflow post:
https://stackoverflow.com/a/45799171/799593