Replace.md - hugo - [fork] hugo port for 9front
(HTM) git clone https://git.drkhsh.at/hugo.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Submodules
(DIR) README
(DIR) LICENSE
---
Replace.md (558B)
---
1 ---
2 title: strings.Replace
3 description: Returns a copy of INPUT, replacing all occurrences of OLD with NEW.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: [replace]
9 returnType: string
10 signatures: ['strings.Replace INPUT OLD NEW [LIMIT]']
11 aliases: [/functions/replace]
12 ---
13
14 ```go-html-template
15 {{ $s := "Batman and Robin" }}
16 {{ replace $s "Robin" "Catwoman" }} → Batman and Catwoman
17 ```
18
19 Limit the number of replacements using the `LIMIT` argument:
20
21 ```go-html-template
22 {{ replace "aabbaabb" "a" "z" 2 }} → zzbbaabb
23 ```