title: Reading double values from a text file
body: <p>Trying to read data from a text file using a C# application. There're multiple lines of data and each of them start with an integer and then followed by bunch of double values. A part of the text file looks like this,</p>
  
  <pre class="lang-none prettyprint-override"><code>   33 0.573140941467E-01 0.112914262390E-03 0.255553577735E-02 0.497192659486E-04 0.141869181079E-01-0.147813598922E-03
     34 0.570076593453E-01 0.100112550891E-03 0.256427138318E-02-0.868691490164E-05 0.142821920093E-01-0.346011975369E-03
     35 0.715507714946E-01 0.316132133031E-03-0.106581466521E-01-0.920513736900E-04 0.138018668842E-01-0.212219497066E-03
  </code></pre>
  
  <p>Here 33, 34, 35 are integer values and it's followed by 6 double values. And these double values are not guaranteed to have space or some other delimiter between them. i.e., if a double is negative then it will have a "-" before it and this will take up the space. So basically, it's possible that all 6 double values will be together.</p>
  
  <p>Now the challenge is, how to extract this gracefully?</p>
  
  <p>What I tried:</p>
  
  <pre><code>String.Split(' ');
  </code></pre>
  
  <p>This will not work as a space is not guaranteed between the initial integer values and then the rest of double values.</p>
  
  <p>This can be easily solved in C++ using <code>sscanf</code>.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>double a, b, c, d, e, f;
  
  sscanf(string, "%d %lf%lf%lf%lf%lf%lf", &amp;a, &amp;b, &amp;c, &amp;d, &amp;e, &amp;f);
  // here string contains a line of data from text file.
  </code></pre>
  
  <p>The text file containing double values are generated by a 3rd party tool and I have no control over its output.</p>
  
  <p>Is there a way the integer and double values can be gracefully extracted line by line?</p>