Function rufl::string::is_dns

source ·
pub fn is_dns(s: impl AsRef<str>) -> bool
Expand description

Checks if the string is a valid domain name.

§Arguments

  • s - The string to check.

§Returns

Returns true if string is a valid domain name, false if not.

§Examples

use rufl::string;

assert_eq!(true, string::is_dns("abc.com"));

assert_eq!(true, string::is_dns("123.cn"));

assert_eq!(false, string::is_dns("abc@123.com"));