diff options
Diffstat (limited to 'docs/content/en/functions/path/Clean.md')
-rw-r--r-- | docs/content/en/functions/path/Clean.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/docs/content/en/functions/path/Clean.md b/docs/content/en/functions/path/Clean.md new file mode 100644 index 000000000..98160c568 --- /dev/null +++ b/docs/content/en/functions/path/Clean.md @@ -0,0 +1,35 @@ +--- +title: path.Clean +description: Replaces path separators with slashes (`/`) and removes extraneous separators. +categories: [functions] +keywords: [] +menu: + docs: + parent: functions +function: + aliases: [] + returnType: string + signatures: [path.Clean PATH] +relatedFunctions: + - path.Base + - path.BaseName + - path.Clean + - path.Dir + - path.Ext + - path.Join + - path.Split +aliases: [/functions/path.clean] +--- + +`path.Clean` replaces path separators with slashes (`/`) and removes extraneous separators, including trailing separators. + +```go-html-template +{{ path.Clean "foo//bar" }} → "foo/bar" +{{ path.Clean "/foo/bar/" }} → "/foo/bar" +``` + +On a Windows system, if `.File.Path` is `foo\bar.md`, then: + +```go-html-template +{{ path.Clean .File.Path }} → "foo/bar.md" +``` |