#numbers #string #check #parser #validation

is_number

Check if a string can be parsed as a number

2 releases

new 0.1.1 Nov 17, 2024
0.1.0 Nov 17, 2024

#105 in Parser tooling

Download history 164/week @ 2024-11-13

164 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