This commit is contained in:
2024-02-22 14:52:53 -05:00
parent 72c94666c5
commit 29b417e3f7
445 changed files with 360852 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace MarketData.CSVHelper
{
public class StringParser
{
private StringParser()
{
}
public static string[] ParseDelimitedString(string arguments, char delim = ',')
{
var regex = new Regex("(?<=^|,)(\"(?:[^\"]|\"\")*\"|[^,]*)");
List<String> values = new List<String>();
foreach (Match m in regex.Matches(arguments))
{
String value = m.Value;
if (null != value && value.StartsWith("\"") && value.EndsWith("\""))
{
value = value.Substring(1, value.Length - 2);
}
values.Add(value);
}
return values.ToArray();
}
}
}