URL.IsAbs in Go

Posted by GoDoc
Public (Editable by Users)

IsAbs reports whether the URL is absolute. Absolute means that it has a non-empty scheme.

Go
Edit
package main

import (
	"fmt"
	"net/url"
)

func main() {
	u := url.URL{Host: "example.com", Path: "foo"}
	fmt.Println(u.IsAbs())
	u.Scheme = "http"
	fmt.Println(u.IsAbs())
}