1 unstable release

0.1.0 Nov 12, 2016

#7 in #num

Download history 9/week @ 2019-12-13 1/week @ 2019-12-20 3/week @ 2019-12-27 2/week @ 2020-01-03 20/week @ 2020-01-10 8/week @ 2020-01-17 11/week @ 2020-01-24 8/week @ 2020-01-31 12/week @ 2020-02-07 1/week @ 2020-02-14 32/week @ 2020-02-21 35/week @ 2020-02-28 5/week @ 2020-03-06 8/week @ 2020-03-13 4/week @ 2020-03-20 11/week @ 2020-03-27

77 downloads per month
Used in 4 crates (via quire)

MIT/Apache

9KB
162 lines

Human Num

Status:beta
Documentation:http://tailhook.github.io/humannum/

Human-friendly numeric parser.

Supported features:

  • Supports for underscore in numbers 1_000 → 1000
  • k, M, G -- decimal suffixes 25M → 25000000
  • ki, Mi, Gi -- binary suffixes 8Ki → 8192
  • 0x, 0o, 0b -- prefixes numeral systems 0xFF → 255, 0o40 → 32, 0b11 → 3
  • Wrapper type that implements FromStr

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


lib.rs:

Human-friendly number parser

Currently this only currently implements parsing of integers.

The format of values accepted is described in docstring of parse_integer.

Example (Functional)

use humannum::parse_integer;
let x: u64 = parse_integer("1_320 k").unwrap();
assert_eq!(x, 1320000);

Example (wrapper)

use humannum::Int;
let x: Int<u32> = "0o1777".parse().unwrap();
assert_eq!(*x, 0o1777)

Dependencies

~230KB