mirror of
https://github.com/gohugoio/hugoDocs.git
synced 2025-09-10 12:59:52 -04:00
tpl: Add strings.Repeat
This commit is contained in:
parent
a6b9f654a2
commit
828ea5f15c
31
content/en/functions/strings.Repeat.md
Normal file
31
content/en/functions/strings.Repeat.md
Normal file
@ -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"
|
||||||
|
```
|
@ -3410,6 +3410,20 @@
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"Repeat": {
|
||||||
|
"Description": "Repeat returns a new string consisting of count copies of the string s.",
|
||||||
|
"Args": [
|
||||||
|
"s",
|
||||||
|
"n"
|
||||||
|
],
|
||||||
|
"Aliases": null,
|
||||||
|
"Examples": [
|
||||||
|
[
|
||||||
|
"{{ \"yo\" | strings.Repeat 4 }}",
|
||||||
|
"yoyoyoyo"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
"Truncate": {
|
"Truncate": {
|
||||||
"Description": "Truncate truncates a given string to the specified length.",
|
"Description": "Truncate truncates a given string to the specified length.",
|
||||||
"Args": [
|
"Args": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user