diff options
author | dupoxy <dupoxy@users.noreply.github.com> | 2018-12-13 18:52:17 +0000 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-12-13 19:40:13 +0000 |
commit | 57de1af78c30d7f06e788b33c96341f286f36f4d (patch) | |
tree | 835d33212fa367b907da1e3f4b0867a6469cc0f7 /src/bytes | |
parent | 01eb1d045963a554a39b40c964e9411183dcc42e (diff) | |
download | go-57de1af78c30d7f06e788b33c96341f286f36f4d.tar.gz go-57de1af78c30d7f06e788b33c96341f286f36f4d.zip |
bytes: add ReplaceAll example
Change-Id: I36cc0b68a5a47ac78982b05118c58723c9c6648c
GitHub-Last-Rev: 0704d9569407d8b84d1ddcf845b759f7daa91ec1
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>
Diffstat (limited to 'src/bytes')
-rw-r--r-- | src/bytes/example_test.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bytes/example_test.go b/src/bytes/example_test.go index 4d5cdfa280..6d328378fa 100644 --- a/src/bytes/example_test.go +++ b/src/bytes/example_test.go @@ -298,6 +298,12 @@ func ExampleReplace() { // 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() { rs := bytes.Runes([]byte("go gopher")) for _, r := range rs { |