swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

parsing string with NumberFormatter results in nil on Linux #4616

Open bryceac opened 2 years ago

bryceac commented 2 years ago

Describe the bug NumberFormatter.number(from:) is nil on Linux, but works fine on macOS.

Steps To Reproduce Steps to reproduce the behavior:

  1. create a string with a number value (e.g. "1,500.50")
  2. create NumberFormatter with style set to currency and currency symbol set to empty.
  3. use NumberFormatter.number(from:) and try to use the unwrapped value

Expected behavior I expect to be able to get a string parsed to a value, like I can on macOS, that can be obtained via the doubleValue property.

Environment (please fill out the following information) Fedora 36 and Devuan Beowulf (equivalent to Ubuntu 18.04) Swift 5.6 toolchain. Locale: en_US.UTF-8

tbkka commented 2 years ago

CC: @parkera