Standard library / bytes

bytes.Runes()

Decodes the input into a rune slice. Invalid UTF-8 bytes become replacement runes. Expected stdout: '[U+00E9]\n'.

Formal Syntax & Structure

go syntaxgo
func Runes(s []byte) []rune

Parameters & Attributes

NameTypeDescription
s[]byteInput text or sequence.

Return Value

[]rune

Decodes the input into a rune slice. Invalid UTF-8 bytes become replacement runes.

Working Example

Example Snippetgo
package main
import (  "bytes"  "fmt")
func main() {  fmt.Printf("%U\n", bytes.Runes([]byte("é")))}
Go Reference