private static string RemoveCommas(string value,
if (string.IsNullOrEmpty(value))
var result = new StringBuilder(value.Length);
bool inQuotation = false;
foreach (char c in value)
if (c != ',' || !inQuotation) {
inQuotation = !inQuotation;
return result.ToString();
public static void Main() {
var result = RemoveCommas("12,\"text, is\",\"another 25,000\",23,\"hello\"");
Console.WriteLine(result);