Golang bytes.ToUpper() function example

package bytes

ToUpper returns a copy of the input byte slice with all Unicode letters mapped to their upper case.

Golang bytes.ToUpper() function usage example

 package main

 import (
 "fmt"
 "bytes"
 )

 func main() {
 str := []byte("a funky şğüöıi string.")

 toupper := bytes.ToUpper(str)


 fmt.Println("Original : " + string(str))

 fmt.Println("ToUpper : " + string(toupper))


 }

Output :

Original : a funky şğüöıi string.

ToUpper : A FUNKY ŞĞÜÖII STRING.

Reference :

http://golang.org/pkg/bytes/#ToUpper

Advertisement