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:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Geeks For Geeks

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Computer Science Portal
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.