#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

#334 in Value formatting

Download history 36/week @ 2024-07-27 61/week @ 2024-08-03 52/week @ 2024-08-10 80/week @ 2024-08-17 86/week @ 2024-08-24 109/week @ 2024-08-31 26/week @ 2024-09-07 156/week @ 2024-09-14 146/week @ 2024-09-21 134/week @ 2024-09-28 103/week @ 2024-10-05 197/week @ 2024-10-12 23/week @ 2024-10-19 61/week @ 2024-10-26 167/week @ 2024-11-02 118/week @ 2024-11-09

385 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