IsAbs
Overview
IsAbs reports whether p is absolute (path.isAbsolute).
If you are coming from Node.js, the closest pattern is path.isAbsolute(p).
Signature
go
func IsAbs(p string) boolCompare: Node.js · Standard Go · gox
js
path.isAbsolute('/foo');go
ok := filepath.IsAbs(p)go
import "github.com/sahilkhaire/gox/path"
ok := path.IsAbs(p)Example
go
import "github.com/sahilkhaire/gox/path"
ok := path.IsAbs(p)Tips
Import github.com/sahilkhaire/gox/path and call IsAbs directly. See the comparison below for the standard library equivalent.
Standard library alternative
Use the standard library directly:
go
ok := filepath.IsAbs(p)