#comma #num #number #split #separate

separator

Formats numbers into strings with thousands separators for readability

6 releases (3 breaking)

✓ Uses Rust 2018 edition

0.4.1 Mar 29, 2019
0.4.0 Nov 24, 2018
0.3.1 Nov 19, 2015
0.3.0 Jul 31, 2015
0.1.0 Jul 30, 2015

#1 in #number

Download history 18684/week @ 2019-06-02 40459/week @ 2019-06-09 12144/week @ 2019-06-16 1986/week @ 2019-06-23 1451/week @ 2019-06-30 1302/week @ 2019-07-07 792/week @ 2019-07-14 1161/week @ 2019-07-21 1076/week @ 2019-07-28 1068/week @ 2019-08-04 1033/week @ 2019-08-11 1453/week @ 2019-08-18 1618/week @ 2019-08-25 1638/week @ 2019-09-01 1979/week @ 2019-09-08

64,041 downloads per month
Used in 32 crates (14 directly)

MIT license

8KB
183 lines

crates.io Build Status

rust-separator

NOTE: This crate is entirely superseded by the very excellent num-format, which has all the features of separator and much, much more. I highly recommend using num-format instead of this crate.

Formats numbers into strings with thousands separators for readability. It currently supports floating-points (f32 and f64), unsigned integers (u16, u32, u64, u128), signed integers (i16, i32, i64, i128), and size types (isize and usize).

Usage

First, put separator as a dependency in your Cargo.toml as usual:

[dependencies]
separator = "0.3.1"

Then, import the Separatable trait, and call the separated_string on a number:

extern crate separator;

use separator::Separatable;

fn main() {
  let f = -120000000.34345;

  // Prints "-12,000,000.34345"
  println!("{}", f.separated_string());
}

No runtime deps