bytes: add ReplaceAll example

This commit is contained in:
dupoxy 2018-12-12 21:57:04 +01:00 committed by GitHub
parent d1882c9866
commit 4ca6648eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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 {