Skip to main content

split_host_port

Function split_host_port 

Source
pub fn split_host_port(input: &str) -> (&str, &str)
Expand description

Splits the host part and the port part from an hostname

  • “127.0.0.1” -> (“127.0.0.1”, “”)
  • “127.0.0.1:80” -> (“127.0.0.1”, “80”)
  • “[::1]” -> (“::1”, “”)
  • “[::1]:8080” -> (“::1”, “8080”)
  • “localhost:8080” -> (“localhost”, “8080”)