title: universal parsing of strings into float
body: <p>In the environment that my program is going to run, people use ',' and '.' as decimal separators randomly on PCs with ',' and '.' separators.</p>
  
  <p>How would you implements such a floatparse(string) function?</p>
  
  <p>I tried this one:</p>
  
  <pre><code>    try
      {
          d = float.Parse(s);
      }
      catch
      {
          try
          {
              d = float.Parse(s.Replace(".", ","));
          }
          catch
          {
              d = float.Parse(s.Replace(",", "."));
          }
      }
  </code></pre>
  
  <p>It doesn't work. And when I debugg it turns out that it parses it wrong the first time thinking that "." is a separator for thousands (like 100.000.000,0).</p>
  
  <p>I'm noob at C#, so hopefully there is less overcomplicated solution then that :-)</p>
  
  <p>NB: People a going to use both '.' and ',' in PCs with different separator settings.</p>