Standard library / unicode/utf16

utf16.DecodeRune()

Decodes a valid high/low surrogate pair, otherwise returns U+FFFD. Expected stdout: 'U+1F600\n'.

Formal Syntax & Structure

go syntaxgo
func DecodeRune(r1, r2 rune) rune

Parameters & Attributes

NameTypeDescription
r1runeFirst code point of the surrogate pair.
r2runeSecond code point of the surrogate pair.

Return Value

rune

Decodes a valid high/low surrogate pair, otherwise returns U+FFFD.

Working Example

Example Snippetgo
package main
import (  "fmt"  "unicode/utf16")
func main() {  fmt.Printf("%U\n", utf16.DecodeRune(0xd83d, 0xde00))}
Go Reference