Convert String with Dot or Comma to Float Number

The Float.parseFloat() method is not locale-dependent. It expects a dot as decimal separator. If the decimal separator in your input is always dot, you can use this safely.

The NumberFormat class provides locale-aware parse and format should you need to adapt for different locales.

Leave a Comment