common

package
v0.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2018 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PathHasPrefix

func PathHasPrefix(p, prefix string) bool

PathHasPrefix returns whether the slash-separated path p has the given prefix. Unlike strings.HasPrefix, this function respects component boundaries, so "/home/foo" is not a prefix is "/home/foobar/baz". If the prefix is empty, this function always returns true.

func PathTrimPrefix

func PathTrimPrefix(p, prefix string) string

PathTrimPrefix returns p without the provided prefix. If p doesn't start with prefix, it returns p unchanged. Unlike strings.HasPrefix, this function respects component boundaries (assuming slash-separated paths), so PathTrimPrefix("foo/bar", "foo") returns "baz".

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL