Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleBuffer_Grow (0.24 sec)

  1. src/bytes/example_test.go

    func ExampleBuffer_Cap() {
    	buf1 := bytes.NewBuffer(make([]byte, 10))
    	buf2 := bytes.NewBuffer(make([]byte, 0, 10))
    	fmt.Println(buf1.Cap())
    	fmt.Println(buf2.Cap())
    	// Output:
    	// 10
    	// 10
    }
    
    func ExampleBuffer_Grow() {
    	var b bytes.Buffer
    	b.Grow(64)
    	bb := b.Bytes()
    	b.Write([]byte("64 bytes or fewer"))
    	fmt.Printf("%q", bb[:b.Len()])
    	// Output: "64 bytes or fewer"
    }
    
    func ExampleBuffer_Len() {
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
Back to top