Skip to content

Instantly share code, notes, and snippets.

@aarshtalati
Created August 21, 2017 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarshtalati/63a07c3547fece8fe67aa661eb4e6b3a to your computer and use it in GitHub Desktop.
Save aarshtalati/63a07c3547fece8fe67aa661eb4e6b3a to your computer and use it in GitHub Desktop.
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