protected string[] Split(string s)
{
Regex r = new Regex(",(?=([^']*'[^']*')*(?![^']*'))");
List
int sStart = 0;
int nCount = 0;
foreach (Match m in r.Matches(s))
{
list.Add(s.Substring(sStart, m.Index - sStart).Trim('"'));
sStart = m.Index + 1;
}
list.Add(s.Substring(sStart, s.Length - sStart).Trim('"'));
return list.ToArray();
}
No comments:
Post a Comment