#numbers #comma #split #num #separate #format

separator

Formats numbers into strings with thousands separators for readability

6 releases (3 breaking)

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

#1010 in Rust patterns

Download history 21806/week @ 2024-01-13 21611/week @ 2024-01-20 20366/week @ 2024-01-27 18864/week @ 2024-02-03 20086/week @ 2024-02-10 27494/week @ 2024-02-17 24248/week @ 2024-02-24 19282/week @ 2024-03-02 21549/week @ 2024-03-09 21547/week @ 2024-03-16 21581/week @ 2024-03-23 31094/week @ 2024-03-30 31526/week @ 2024-04-06 25064/week @ 2024-04-13 23921/week @ 2024-04-20 14553/week @ 2024-04-27

100,285 downloads per month
Used in 56 crates (29 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