Standard library / bytes

bytes.Buffer.UnreadRune()

Undoes the last successful ReadRune; fails if the last operation was not a valid rune read. Expected stdout: '<nil> é\n'.

Formal Syntax & Structure

go syntaxgo
func (b *Buffer) UnreadRune() error

Return Value

error

Undoes the last successful ReadRune; fails if the last operation was not a valid rune read.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  b := bytes.NewBufferString("é")  b.ReadRune()  e := b.UnreadRune()  fmt.Println(e, b.String())}
Go Reference