#numbers #string #check #parser #validation

is_number

Check if a string can be parsed as a number

2 releases

0.1.1 Nov 17, 2024
0.1.0 Nov 17, 2024

#95 in Parser tooling

Download history 6/week @ 2024-11-11 226/week @ 2024-11-18 1/week @ 2024-11-25 36/week @ 2024-12-09

269 downloads per month

MIT license

6KB
85 lines

Is Number

A Rust library to check if a string represents a valid number.

Usage

Add this to your Cargo.toml:

[dependencies]
is_number = "0.1.0"

Examples

use is_number::is_number;

fn main() {
assert!(is_number("123"));
assert!(is_number("-123.456"));
assert!(is_number("1.23e-5"));
}

lib.rs:

A library to check if a string can be parsed as a number Similar to the is-number npm package

No runtime deps