Skip to main content

host

Function host 

Source
pub fn host(url: &str) -> Option<String>
Expand description

The host of an absolute http(s) URL, lower-cased, without port, userinfo or a leading www.. None for anything else.

use ai_answer_citations::host;
assert_eq!(host("https://WWW.Example.com:8443/a"), Some("example.com".to_string()));
assert_eq!(host("/relative"), None);