Here, We will learn about Title() function in strings package in go. Title() function is used to get a copy of the string with all Unicode letters that begin words mapped to their Unicode title case in go golang.
Function prototype:
func Title(str string) string
Return value:
Title() function in strings package returns
a copy of the string str with all Unicode
letters that begin words mapped to their
Unicode title case.
Example with code:
package main
import (
"fmt"
"strings"
)
func main() {
s := strings.Title("Hello google")
fmt.Println(s)
s = strings.Title("Hello go golang")
fmt.Println(s)
s = strings.Title("Hey Jon !!!")
fmt.Println(s)
s = strings.Title("Teremenm fr # $kk ")
fmt.Println(s)
}
Output:
Hello Google
Hello Go Golang
Hey Jon !!!
Teremenm Fr # $Kk
To learn more about golang, Please refer given below link:
https://techieindoor.com/go-lang-tutorial/
References:
https://golang.org/doc/
https://golang.org/pkg/