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
+7.5k Golang : Process json data with Jason package
+10.3k Golang : Convert file unix timestamp to UTC time example
+52.6k Golang : How to get struct field and value by name
+80.6k Golang : How to return HTTP status code?
+17.9k Golang : Qt image viewer example
+18.5k Golang : Aligning strings to right, left and center with fill example
+8.4k Golang : Convert word to its plural form example
+19k Golang : Padding data for encryption and un-padding data for decryption
+10.6k Golang : Flip coin example
+36.5k Golang : Validate IP address
+9.4k Golang : Apply Histogram Equalization to color images
+30.8k Golang : Download file example