strings: add ReplaceAll example

Change-Id: I6b0d470bdedb92844943c8e5823e214d6a7471cf
GitHub-Last-Rev: 4a135000ba9c23a588b960e5b2989710cc71e3e2
GitHub-Pull-Request: golang/go#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>
This commit is contained in:
dupoxy 2018-12-12 22:49:31 +00:00 committed by Brad Fitzpatrick
parent e123ccbfe0
commit 09da280157

View File

@ -205,6 +205,12 @@ func ExampleReplace() {
// moo moo moo
}
func ExampleReplaceAll() {
fmt.Println(strings.ReplaceAll("oink oink oink", "oink", "moo"))
// Output:
// moo moo moo
}
func ExampleSplit() {
fmt.Printf("%q\n", strings.Split("a,b,c", ","))
fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a "))