title |
description |
date |
publishdate |
lastmod |
categories |
menu |
keywords |
signature |
workson |
hugoversion |
relatedfuncs |
deprecated |
aliases |
replace |
Replaces all occurrences of the search string with the replacement string. |
2017-02-01 |
2017-02-01 |
2020-09-07 |
|
|
|
replace INPUT OLD NEW [LIMIT] |
strings.Replace INPUT OLD NEW [LIMIT] |
|
|
|
|
false |
|
Replace returns a copy of INPUT
with all occurrences of OLD
replaced with NEW
.
The number of replacements can be limited with an optional LIMIT
parameter.
`{{ replace "Batman and Robin" "Robin" "Catwoman" }}`
→ "Batman and Catwoman"
{{ replace "aabbaabb" "a" "z" 2 }} → "zzbbaabb"