From 80c1ce631b2c822cb847f83f2f27ef0be4cbae23 Mon Sep 17 00:00:00 2001 From: digitalcraftsman Date: Mon, 25 Sep 2017 19:11:45 +0200 Subject: [PATCH] Document strings.TrimLeft and TrimRight template functions Closes #147 --- content/functions/strings.TrimLeft.md | 28 ++++++++++++++++++++++++++ content/functions/strings.TrimRight.md | 28 ++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 content/functions/strings.TrimLeft.md create mode 100644 content/functions/strings.TrimRight.md diff --git a/content/functions/strings.TrimLeft.md b/content/functions/strings.TrimLeft.md new file mode 100644 index 000000000..246facd62 --- /dev/null +++ b/content/functions/strings.TrimLeft.md @@ -0,0 +1,28 @@ +--- +title: strings.TrimLeft +description: Returns a slice of a given string with all leading characters contained in the cutset removed. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [strings] +signature: ["strings.TrimLeft CUTSET STRING"] +workson: [] +hugoversion: +relatedfuncs: [strings.TrimRight] +deprecated: false +aliases: [] +--- + +Given the string `"abba"`, leading `"a"`'s can be removed a follows: + + {{ strings.TrimLeft "abba" "a" }} → "bba" + +Numbers can be handled as well: + + {{ strings.TrimLeft 1221 "12" }} → "" + diff --git a/content/functions/strings.TrimRight.md b/content/functions/strings.TrimRight.md new file mode 100644 index 000000000..44cb9edcf --- /dev/null +++ b/content/functions/strings.TrimRight.md @@ -0,0 +1,28 @@ +--- +title: strings.TrimRight +description: Returns a slice of a given string with all trailing characters contained in the cutset removed. +godocref: +date: 2017-02-01 +publishdate: 2017-02-01 +lastmod: 2017-02-01 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [strings] +signature: ["strings.TrimRight CUTSET STRING"] +workson: [] +hugoversion: +relatedfuncs: [strings.TrimRight] +deprecated: false +aliases: [] +--- + +Given the string `"abba"`, trailing `"a"`'s can be removed a follows: + + {{ strings.TrimRight "abba" "a" }} → "abb" + +Numbers can be handled as well: + + {{ strings.TrimRight 1221 "12" }} → "" +