Standard library / bufio
bufio.Reader.UnreadRune()
Undoes the last successful ReadRune only; other operations invalidate this ability. Expected stdout: 'é <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Reader) UnreadRune() errorReturn Value
error
Undoes the last successful ReadRune only; other operations invalidate this ability.
Working Example
Example Snippetgo
package main
import ( "bufio" "fmt" "strings")
func main() { r := bufio.NewReader(strings.NewReader("é")) r.ReadRune() e := r.UnreadRune() c, _, _ := r.ReadRune() fmt.Println(string(c), e)}