Announcement: New crate "num-format"

Hello everyone. I just published a new crate to and thought I would share it here.

The crate is called num-format. It's designed to help you generate string representations of numbers, formatted according to international standards. For example, given 1000000usize, it can produce:

  • "1,000,000" for US English
  • "10,00,000" for Indian English
  • "1 000 000" for French French

It comes with a Locale enum that has been programmatically generated from the Unicode Consortium's Common Locale Data Repository, which is how macOS and many others get their localization information; so there are literally hundreds of locales to choose from. If you'd like to use a customized formatting policy, you can do do that as well.

In addition to including comprehensive localization features, num-format is also built for speed. Taking inspiration from dtolnay's fantastic itoa crate, I made sure you can create a formatted &str representation without any heap allocation (i.e that you can write into a stack-allocate buffer). This is much faster, but it also means that num-format can be used in a no_std environment.

The formatting capabilities of num-format are currently available for all the "integer" types in the standard library (e.g. u8, u16, etc.; i8, i16, etc.; NonZeroU8, NonZeroU16, etc.) as well as types from the num crate (available behind a feature flag).

In the future, I'd like to expand the capabilities of num-format to include support for floating point numbers as well, but this is not yet implemented. If you'd like to help work on this feature, please let me know!