Standard library / strings

strings.Builder.Reset()

Clears the Builder so it can build a new string. Do not assume capacity is retained. Expected stdout: '0\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Builder) Reset()

Working Example

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