Compact number formats for NumberFormatter
Originator: | eidingermarco | ||
Number: | rdar://FB9950508 | Date Originated: | 2022-03-08 |
Status: | Open | Resolved: | |
Product: | Foundation | Product Version: | |
Classification: | Suggestion | Reproducible: |
The `Foundation` framework and its class `NumberFormatter` provide various styles (e.g. decimal, percent, scientific, spellOut or currency) but no compact style. A compact decimal number formatting would convert 1000 into 1K or 1100000 into 1.1M which is a common requirement for app developers. A pull request containing a draft implementation: https://github.com/apple/swift-corelibs-foundation/pull/2710 It would be great if Foundation.NumberFormatter can provide handling for such compact styles out-of-the-box.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!