mirror of
https://github.com/golang/go.git
synced 2025-05-20 06:43:26 +00:00
strings: add Fields example
R=golang-dev, rsc, r CC=golang-dev https://golang.org/cl/5629043
This commit is contained in:
parent
a044154a4c
commit
10f1b6a074
15
src/pkg/strings/example_test.go
Normal file
15
src/pkg/strings/example_test.go
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2012 The Go Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style
|
||||||
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
|
package strings_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Fields are: ["foo" "bar" "baz"]
|
||||||
|
func ExampleFields() {
|
||||||
|
fmt.Printf("Fields are: %q", strings.Fields(" foo bar baz "))
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user