title: Android: Parsing EU currency into a Number
body: <p>I have an EditText which should work as follows (Android 2.3.3):</p>
  
  <p>The user enters for instance 10,40 (which is 10 Euro and 40 Cents in EU currency) - I want to then take that String input and convert it to a BigDecimal (or Number etc...) for instance, for further internal computation.</p>
  
  <p>The same should work if the user enters 10.40 (which - in the case of US Dollar would amount to 10 Dollars and 40 Cents), then take that String input and convert it to a BigDecimal (or Number etc...) for instance.</p>
  
  <p>I tried the following (based on Michael Petrotta's answer <a href="https://stackoverflow.com/questions/965831/how-to-parse-a-currency-amount-us-or-eu-to-float-value-in-java">here</a>), which fails with "ParseException: Unparsable Number 10,40):</p>
  
  <pre><code>    // German input
      NumberFormat formatter = NumberFormat.getCurrencyInstance(Locale.GERMANY);
      // User input
      String value = "10,40";
      Number valueParsed = formatter.parse(value);
  </code></pre>
  
  <p>I also tried "10,40 €" to no avail. So either I am misunderstanding the purpose of NumberFormat.parse or I'm on a wrong track all together...? I really want to avoid using Regular Expressions to replace the comma in "10,40" for the version should work internationally and I'd like some clean, Locale-based approach.</p>
  
  <p>EDIT</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/4323599/best-way-to-parsedouble-with-comma-as-decimal-separator">this question</a> which addresses the same issue - the correct answer uses the same approach that I do, so I tried again (using France as a Locale this time) but it fails nonetheless, which seems quite odd... The comment under the referenced question suggested using replaceAll(",", ".") which seems a bad idea to me, as some currencies use the comma as a divider for thousands, such as the US Dollar if I am not mistaken. I could however check the locale but that all seams shady :( and potentially erroneous ...</p>