Standard library / unicode/utf16

utf16.IsSurrogate()

Reports whether r lies in the UTF-16 surrogate code-point range D800–DFFF. Expected stdout: 'true false\n'.

Formal Syntax & Structure

go syntaxgo
func IsSurrogate(r rune) bool

Parameters & Attributes

NameTypeDescription
rruneUnicode code point.

Return Value

bool

Reports whether r lies in the UTF-16 surrogate code-point range D800–DFFF.

Working Example

Example Snippetgo
package main
import (  "fmt"  "unicode/utf16")
func main() {  fmt.Println(utf16.IsSurrogate(0xd800), utf16.IsSurrogate('A'))}
Go Reference