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.3k Javascript : Shuffle or randomize array example
+6.2k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+8.4k Golang : Convert word to its plural form example
+6.2k PHP : Get client IP address
+7.1k Golang : Array mapping with Interface
+19.8k Golang : Append content to a file
+5k Golang : micron to centimeter example
+6.5k PHP : Shuffle to display different content or advertisement
+5.8k Javascript : How to replace HTML inside <div>?
+9.2k Golang : does not implement flag.Value (missing Set method)
+12.5k Golang : "https://" not allowed in import path
+9.5k Golang : Extract or copy items from map based on value