for (var index = 0; index < str.Length; index++)
{
if (!char.IsWhiteSpace(str[index]) && str[index] != '_' && str[index] != ',')
{
significantCharacterAfterComma = true;
}
if (str[index] == ',')
{
significantCharacterAfterComma = false;
}
if (!significantCharacterAfterComma && str[index] == ',')
{
return str.Remove(index, 1);
}
}