1
0
mirror of https://github.com/golang/go synced 2024-11-13 18:20:32 -07:00

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: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Erin Masatsugu 2018-08-30 18:27:07 +00:00 committed by Ian Lance Taylor
parent 0dac1e2e87
commit 5e755e9d6d

View File

@ -39,6 +39,14 @@ func ExampleBuffer_Grow() {
// 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() {
// Interpret Compare's result by comparing it to zero.
var a, b []byte