Golang unicode/utf16.Decode() function example
package unicode/utf16
Golang unicode/utf16.Decode() function usage example
package main
import (
"fmt"
"unicode/utf16"
)
func main() {
var rune_array []rune
rune_array = utf16.Decode([]uint16{0xdfff})
fmt.Println(rune_array)
rune_array = utf16.Decode([]uint16{'爱', 0xd800, 'a'})
fmt.Println(rune_array)
}
Output :
[65533]
[29233 65533 97]
Reference :
https://golang.org/pkg/unicode/utf16/#Decode
Advertisement
Something interesting
Tutorials
+7.6k Golang : Combine slices but preserve order example
+7.9k Golang : Find the length of big.Int variable example
+13.1k Golang : Find network of an IP address
+8.2k Golang : Read file with ioutil
+4.8k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+16.1k Golang : How to make a file read only and set it to writable again?
+4.4k Unix/Linux : How to archive and compress entire directory ?
+12.4k Golang : Set image canvas or background to transparent
+16.1k Golang : When to use init() function?
+16.1k Golang : Find smallest number in array
+11.1k Golang : convert(cast) string to integer value
+8.1k Golang : Generate Codabar