mirror of https://github.com/golang/go.git
strings: add ReplaceAll example
Change-Id: I6b0d470bdedb92844943c8e5823e214d6a7471cf
GitHub-Last-Rev: 4a135000ba
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:
parent
e123ccbfe0
commit
09da280157
|
|
@ -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 "))
|
||||
|
|
|
|||
Loading…
Reference in New Issue