pub fn is_number(string: String) -> bool { let string = string.to_lowercase(); if string.contains("inf") || string.contains("nan") { return false; } let mut parts = string.split('e'); let valid_significand = match parts.next() { Some(part) => part.parse::().is_ok(), None => unreachable!(), }; let valid_exponent = match parts.next() { Some(part) => part.parse::().is_ok(), None => true, }; let nothing_remaining = parts.next().is_none(); valid_significand && valid_exponent && nothing_remaining }