Standard library / bufio
bufio.ScanRunes()
Returns one UTF-8 encoded rune per token; invalid encoding becomes the replacement rune. Expected stdout: '2 é <nil>\n'.
Formal Syntax & Structure
go syntaxgo
func ScanRunes(data []byte, atEOF bool) (advance int, token []byte, err error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| data | []byte | Input bytes or destination storage, according to operation. |
| atEOF | bool | Whether the source has reached end of input. |
Return Value
(advance int, token []byte, err error)
Returns one UTF-8 encoded rune per token; invalid encoding becomes the replacement rune.
Working Example
Example Snippetgo
package main
import ( "bufio" "fmt")
func main() { a, t, e := bufio.ScanRunes([]byte("éx"), false); fmt.Println(a, string(t), e) }