RosettaCodeData/Task/Determine-if-a-string-is-numeric/Rust/determine-if-a-string-is-numeric-1.rs
2024-10-16 18:07:41 -07:00

4 lines
181 B
Rust

// This function is not limited to just numeric types but rather anything that implements the FromStr trait.
fn parsable<T: FromStr>(s: &str) -> bool {
s.parse::<T>().is_ok()
}