public static string SplitQuotedLine(this string value, char separator, bool quotes)
{
// Use the "quotes" bool if you need to keep/strip the quotes or something...
var s = new StringBuilder();
var regex = new Regex("(?<=^|,)(\"(?:[^\"]|\"\")*\"|[^,]*)");
foreach (Match m in regex.Matches(value))
{
s.Append(m.Value);
}
return s.ToString();
}