#format #pretty #numbers #itoa

pretty_toa

Fast convert (using itoa/dtoa) numbers to strings with thousands separators

3 releases (1 stable)

1.0.0 Nov 11, 2017
0.1.1 Nov 11, 2017
0.1.0 Nov 11, 2017

#63 in Value formatting

Download history 1/week @ 2019-12-14 4/week @ 2019-12-28 3/week @ 2020-01-11 15/week @ 2020-01-18 2/week @ 2020-01-25 4/week @ 2020-02-08 26/week @ 2020-02-22 6/week @ 2020-03-07 3/week @ 2020-03-14 10/week @ 2020-03-21 4/week @ 2020-03-28

57 downloads per month

MIT license

6KB
115 lines

pretty_toa

Rust crate for converting numbers (integers and floats) to strings with thousands separators.

It is very fast because it uses itoa/dtoa and stack allocated strings.

Usage Example

extern crate pretty_toa;
use pretty_toa::ThousandsSep;

fn main() {
    let num = 123_4567;
    println!("{} => {}", num, num.thousands_sep());

    let num  = 123_4567.1234567;
    println!("{} => {}", num, num.thousands_sep());
}

lib.rs:

Fast convert numbers to strings with thousands separators.

It is very fast because it uses itoa/dtoa and stack allocated strings.

Example

extern crate pretty_toa;
use pretty_toa::ThousandsSep;

fn main() {
    let num = 123_4567;
    println!("{} => {}", num, num.thousands_sep());

    let num  = 123_4567.1234567;
    println!("{} => {}", num, num.thousands_sep());
}

Dependencies

~235KB