Function ip

Source
pub fn ip(ip: &str) -> bool
Expand description

Checks whether the given string is a valid IP address.

Both IPv4 and IPv6 returned as valid.

ยงExample

if dator::ip("1.1.1.1") {
    // 1.1.1.1 is a valid IP
}
if dator::ip("fe80::") {
    // "fe80::" is a valid IP
}
if !dator::ip("example.com") {
    // example.com is not a valid IP
}