Open In App

strings.Title() Function in Golang With Examples

Improve
Improve
Like Article
Like
Save
Share
Report

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

Last Updated : 19 Apr, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads