#numbers #pretty #format #itoa

pretty_toa

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

3 releases (1 stable)

Uses old Rust 2015

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

#323 in Value formatting

Download history 58/week @ 2024-02-26 5/week @ 2024-03-04 18/week @ 2024-03-11 30/week @ 2024-03-18 97/week @ 2024-03-25 84/week @ 2024-04-01 37/week @ 2024-04-08 25/week @ 2024-04-15 22/week @ 2024-04-22 88/week @ 2024-05-06 39/week @ 2024-05-13 57/week @ 2024-05-20 100/week @ 2024-05-27 49/week @ 2024-06-03 35/week @ 2024-06-10

242 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

~295KB