I have the following all number data:
4245 4 553.4 0242 4424.09 2 422404 5955 452
2234234.234 224 -345.25
2423 -234 64.69
I need to process each line individually. I need to remove each third number and output as follows with commas:
Note the space only after each set:
4245,4, 0242,4424.09, 422404,5955
2234234.234,224
2423,-234
With some help, I was able to remove the third zero, but the third number can be any value now:
var input = "4245 4 0 242 4424.09 0 422404 5955 0";
var results = Regex.Replace(input, @"(?:\s+|^)0(\s+)|(\s+0)$|\s+", m =>
m.Groups[1].Success ? ", " :
m.Groups[2].Success ? "" : ",");
But cannot figure out how to remove the third number whether its zero or not. Any help would be appreciated. Thanks.