Golang unicode.To() function example

package unicode

Golang unicode.To() function usage example

 package main

 import (
 "fmt"
 "unicode"
 )

 func main() {

 // upper case  = 0

 UpperCaseRune := unicode.To(0, 'a')
 fmt.Printf("%+q\n", UpperCaseRune)

 // lower case = 1

 LowerCaseRune := unicode.To(1, 'A')
 fmt.Printf("%+q\n", LowerCaseRune)

 // title case = 2

 TitleCaseRune := unicode.To(2, 'a')
 fmt.Printf("%+q\n", TitleCaseRune)

 }

Output :

'A'

'a'

'A'

Reference :

https://golang.org/pkg/unicode/#To

Advertisement