mirror of https://github.com/golang/go.git
bytes: add ReplaceAll example
Change-Id: I36cc0b68a5a47ac78982b05118c58723c9c6648c
GitHub-Last-Rev: 0704d95694
GitHub-Pull-Request: golang/go#29203
Reviewed-on: https://go-review.googlesource.com/c/153842
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
01eb1d0459
commit
57de1af78c
|
|
@ -298,6 +298,12 @@ func ExampleReplace() {
|
||||||
// moo moo moo
|
// moo moo moo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExampleReplaceAll() {
|
||||||
|
fmt.Printf("%s\n", bytes.ReplaceAll([]byte("oink oink oink"), []byte("oink"), []byte("moo")))
|
||||||
|
// Output:
|
||||||
|
// moo moo moo
|
||||||
|
}
|
||||||
|
|
||||||
func ExampleRunes() {
|
func ExampleRunes() {
|
||||||
rs := bytes.Runes([]byte("go gopher"))
|
rs := bytes.Runes([]byte("go gopher"))
|
||||||
for _, r := range rs {
|
for _, r := range rs {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue