Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C# Split CSV string
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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment