Replacement for snprintf
Jacob Carlborg
doob at me.com
Wed Nov 6 18:43:06 UTC 2019
On 2019-11-06 17:17, Petar Kirov [ZombineDev] wrote:
> I think the best way to go is to make it locale-independent and simply
> provide a way for user to specify the decimal separator (and other
> related locale details, if any).
In my experience, I think it's best to leave the locale support to a
separate API. The "snprintf" API is never going to be flexible enough.
No one is using "snprintf" for serious localization.
It's not just the decimal point that needs to be localized. There are
various other number related things that need localization.
Just have a look at the number formatter in Apple's API [1]. It's pretty
big. Then they have separate formatters for currency, length, mass,
interval and more.
[1]
https://developer.apple.com/documentation/foundation/nsnumberformatter?language=objc
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list