Standard library / strings

strings.Builder.Len()

Returns the number of accumulated bytes, not runes. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Builder) Len() int

Return Value

int

Returns the number of accumulated bytes, not runes.

Working Example

Example Snippetgo
package main
import (  "fmt"  "strings")
func main() {  var b strings.Builder  b.WriteString("é")  fmt.Println(b.Len())}
Go Reference