Skip to content

parsing string with NumberFormatter results in nil on Linux #4616

Open
@bryceac

Description

@bryceac

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions