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
+11.4k Golang : Delay or limit HTTP requests example
+7.7k Golang : Mapping Iban to Dunging alphabets
+21.1k Golang : Get password from console input without echo or masked
+5.3k Javascript : Shuffle or randomize array example
+30.4k Golang : How to verify uploaded file is image or allowed file types
+7.4k Golang : Scanf function weird error in Windows
+33k Golang : How to check if a date is within certain range?
+18k Golang : How to log each HTTP request to your web server?
+6k Golang : Experimenting with the Rejang script
+5.6k Golang : Frobnicate or tweaking a string example
+29.1k Golang : Get first few and last few characters from string
+4.6k Mac OSX : Get disk partitions' size, type and name