Commit 5e755e9d authored by Erin Masatsugu's avatar Erin Masatsugu Committed by Ian Lance Taylor

bytes: add example for Buffer.Len

Change-Id: Ide50aba940727a7b32cd33dea5315050f1a34717
Reviewed-on: https://go-review.googlesource.com/132237
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 0dac1e2e
...@@ -39,6 +39,14 @@ func ExampleBuffer_Grow() { ...@@ -39,6 +39,14 @@ func ExampleBuffer_Grow() {
// Output: "64 bytes or fewer" // Output: "64 bytes or fewer"
} }
func ExampleBuffer_Len() {
var b bytes.Buffer
b.Grow(64)
b.Write([]byte("abcde"))
fmt.Printf("%d", b.Len())
// Output: 5
}
func ExampleCompare() { func ExampleCompare() {
// Interpret Compare's result by comparing it to zero. // Interpret Compare's result by comparing it to zero.
var a, b []byte var a, b []byte
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment