#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

#355 in Value formatting

Download history 152/week @ 2024-11-16 114/week @ 2024-11-23 140/week @ 2024-11-30 340/week @ 2024-12-07 95/week @ 2024-12-14 1/week @ 2024-12-21 29/week @ 2024-12-28 222/week @ 2025-01-04 144/week @ 2025-01-11 252/week @ 2025-01-18 208/week @ 2025-01-25 322/week @ 2025-02-01 162/week @ 2025-02-08 220/week @ 2025-02-15 133/week @ 2025-02-22 88/week @ 2025-03-01

616 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

~300KB