Open In App

strings.Title() Function in Golang With Examples

strings.Title() Function returns a copy of string s with all Unicode letters of string whose begin words mapped to their Unicode title case. This method belongs to the strings package.

Syntax:



func Title(s string) string

It returns the string.

Example 1:






// Golang program to illustrate the strings.Title() function
  
package main
  
import (
    "fmt"
    "strings"
)
  
// Main function
func main() {
    fmt.Println(strings.Title("geeks for geeks"))
}

Output:

Geeks For Geeks

Example 2:




// Golang program to illustrate the strings.Title() function
  
package main
  
import (
    "fmt"
    "strings"
)
  
// Main function
func main() {
    fmt.Println(strings.Title("computer science portal"))
}

Output:

Computer Science Portal
Article Tags :