Standard library / bytes
bytes.Buffer.ReadRune()
Consumes the next UTF-8 rune and returns code point, byte width and error; invalid bytes consume one byte as RuneError. Expected stdout: 'é 2 <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Buffer) ReadRune() (r rune, size int, err error)Return Value
(r rune, size int, err error)
Consumes the next UTF-8 rune and returns code point, byte width and error; invalid bytes consume one byte as RuneError.
Working Example
Example Snippetgo
package main
import ( "bytes" "fmt")
func main() { b := bytes.NewBufferString("é") r, n, e := b.ReadRune() fmt.Println(string(r), n, e)}