If the requirement is
to break
the set of coordinates into separate lines, then the
Replace
method of
Regex
class can be used to replace
the spaces which are not preceded by or followed by a comma as shown below:
string kmlInput = @"-86.36762, 37.31916 , 0 -86.43890,37.31916,0 -88.96934,32.11572,0 -84.51434,32.68596,0 -82.87490,35.85792,0 -86.36762,37.31916,0 ";
string csvOutput = Regex.Replace(kmlInput,
@"(?<=[^,]+)\s+(?=[^,]+)","\n",
RegexOptions.CultureInvariant);
Console.WriteLine (csvOutput);