Golang unicode/utf16.IsSurrogate() function example
package unicode/utf16
Golang unicode/utf16.IsSurrogate() function usage example
package main
import (
"fmt"
"unicode/utf16"
)
func main() {
answer := utf16.IsSurrogate('水')
fmt.Println(answer)
answer = utf16.IsSurrogate('\U0001D11E')
fmt.Println(answer)
answer = utf16.IsSurrogate(rune(0xdc00))
fmt.Println(answer)
answer = utf16.IsSurrogate('\u6C34')
fmt.Println(answer)
answer = utf16.IsSurrogate(rune(0xdfff))
fmt.Println(answer)
}
Output :
false
false
true
false
true
Reference :
Advertisement
Something interesting
Tutorials
+5.6k Golang : Skip or discard items of non-interest when iterating example
+27.2k Golang : Detect (OS) Operating System
+7.8k Golang : Capture text return from exec function example
+28.3k Golang : Get and Set User-Agent examples
+26k Golang : Record voice(audio) from microphone to .WAV file
+35.1k Golang : Convert date or time stamp from string to time.Time type
+11.2k Golang : How to check if a string starts or ends with certain characters or words?
+4.4k Golang : Return multiple values from function
+16.1k Golang : How to make a file read only and set it to writable again?
+6.8k Golang : Get today's weekday name and calculate target day distance example
+6.7k Gogland : Where to put source code files in package directory for rookie