diff options
author | David E. Wheeler <david@justatheory.com> | 2018-06-03 02:55:37 -0400 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-06-03 09:55:37 +0300 |
commit | 13435a6f608306c5094fdcd72a1d9538727f91b2 (patch) | |
tree | f452078c55bfe6d326d866f9aaaebf338d560cec /docs/content/en/functions | |
parent | 07b96d16e8679c40e289c9076ef4414ed6eb7f81 (diff) |
tpl: Add strings.Repeat
Diffstat (limited to 'docs/content/en/functions')
-rw-r--r-- | docs/content/en/functions/strings.Repeat.md | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/docs/content/en/functions/strings.Repeat.md b/docs/content/en/functions/strings.Repeat.md new file mode 100644 index 000000000..8dcb8eaa2 --- /dev/null +++ b/docs/content/en/functions/strings.Repeat.md @@ -0,0 +1,31 @@ +--- +title: strings.Repeat +# linktitle: +description: Returns a string consisting of count copies of the string s. +godocref: +date: 2018-05-31 +publishdate: 2018-05-31 +lastmod: 2018-05-31 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [strings] +signature: ["strings.Repeat INPUT COUNT"] +workson: [] +hugoversion: +relatedfuncs: [] +deprecated: false +--- + +`strings.Repeat` provides the Go [`strings.Repeat`](https://golang.org/pkg/strings/#Repeat) function for Hugo templates. It takes a string and a count, and returns a string with consisting of count copies of the string argument. + +``` +{{ strings.Repeat "yo" 3 }} → "yoyoyo" +``` + +`strings.Repeat` *requires* the second argument, which tells the function how many times to repeat the first argument; there is no default. However, it can be used as a pipeline: + +``` +{{ "yo" | strings.Repeat 3 }} → "yoyoyo" +``` |