Skip to content

Commit 09da280

Browse files
dupoxybradfitz
authored andcommitted
strings: add ReplaceAll example
Change-Id: I6b0d470bdedb92844943c8e5823e214d6a7471cf GitHub-Last-Rev: 4a13500 GitHub-Pull-Request: #29199 Reviewed-on: https://go-review.googlesource.com/c/153840 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
1 parent e123ccb commit 09da280

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/strings/example_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ func ExampleReplace() {
205205
// moo moo moo
206206
}
207207

208+
func ExampleReplaceAll() {
209+
fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo"))
210+
// Output:
211+
// moo moo moo
212+
}
213+
208214
func ExampleSplit() {
209215
fmt.Printf("%q\n", strings.Split("a,b,c", ","))
210216
fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a "))

0 commit comments

Comments
 (0)