numsep 0.1.12

Adding thousands-seperators to numbers
Documentation
  • Coverage
  • 42.86%
    6 out of 14 items documented2 out of 7 items with examples
  • Size
  • Source code size: 6.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.55 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • floscodes/rust-numsep
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • floscodes

Adding thousands-seperators to numbers

First of all add the following

[dependencies]
numsep = "0.1.12"

to your Cargo.toml-File.

Examples:

use numsep::*;

let number = 10000;

assert_eq!("10,000", separate(n, Locale::English));

The Locale- enum provides the following country-presets:

    Locale::English,
    Locale::German,
    Locale::Canadian,
    Locale::Swiss,
    Locale::Swiss2,
    Locale::Singapore,

AND a CUSTOM-Scheme...

    Locale::Custom(Scheme)

... that can be used like that:

use numsep::*;

let custom = custom()
     .set_separator("'")
     .set_radix(",");

let n = 2000.5;
 
assert_eq!("2'000,5", separate(n, Locale::Custom(custom)));