I have to convert a German locale formatted String to a BigDecimal. However, I\'m struggling with the best solution.
The following code sho
The Problem is the formatting of your String. You should go with the 3rd Method, but format your String like this: String numberString = "2105.88";
You will be able to see this from the given examples here: Link to Java Api
Edit: Ok, so I see 2 possible solutions for this. Either go with your solution 1 (That's what I prefer) or do something like:
numberString = numberString.replaceAll(".", "");
numberString = numberString.replaceAll(",", ".");
BigDecimal bd3 = new BigDecimal(numberString);