Standard library / bytes

bytes.Reader.UnreadRune()

Undoes the most recent successful ReadRune if no intervening operation invalidated it. Expected stdout: '<nil> 3\n'.

Formal Syntax & Structure

go syntaxgo
func (r *Reader) UnreadRune() error

Return Value

error

Undoes the most recent successful ReadRune if no intervening operation invalidated it.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  r := bytes.NewReader([]byte("aé"))  r.ReadRune()  e := r.UnreadRune()  fmt.Println(e, r.Len())}
Go Reference