Golang bytes.Buffer.Len() function example
package bytes
Len returns the number of bytes of the unread portion of the buffer. Bytes.Buffer.Len() function is the same as len(buffer.Bytes()).
Golang bytes.Len() function usage example
package main
import (
"bytes"
"fmt"
)
func main() {
buff := bytes.NewBufferString("abcdefghi")
fmt.Printf("%d\n", len(buff.Bytes()))
fmt.Printf("%d\n", buff.Len())
}
Output :
9
9
Reference :
Advertisement
Something interesting
Tutorials
+4.6k MariaDB/MySQL : How to get version information
+17.9k Golang : Qt image viewer example
+19.5k Golang : How to Set or Add Header http.ResponseWriter?
+27.5k Golang : Convert integer to binary, octal, hexadecimal and back to integer
+8.2k Golang : Qt splash screen with delay example
+6.5k Golang : Combine slices of complex numbers and operation example
+4.3k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+7.3k Golang : alternative to os.Exit() function
+19.2k Golang : Execute shell command
+14.9k Golang : Submit web forms without browser by http.PostForm example
+5.5k Golang : Stop goroutine without channel
+12.6k Golang : Transform comma separated string to slice example