Reader.Len in Go

Posted by GoDoc
Public (Editable by Users)

Len returns the number of bytes of the unread portion of the slice.

Go
Edit
package main

import (
	"bytes"
	"fmt"
)

func main() {
	fmt.Println(bytes.NewReader([]byte("Hi!")).Len())
	fmt.Println(bytes.NewReader([]byte("こんにちは!")).Len())
}