fork(4) download
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "strings"
  6. )
  7.  
  8. func main() {
  9. strArr := [6]string{"title case", "Title Case", "TITLE CASE", "TiTlE CasE", "Title case", "title CASE"}
  10. for i := 0; i < len(strArr); i++ {
  11. fmt.Println(" ")
  12. fmt.Println("Given Text: ", strArr[i])
  13. fmt.Println("ToTitle: ", strings.ToTitle(strArr[i]))
  14. fmt.Println("ToUpper: ", strings.ToUpper(strArr[i]))
  15. fmt.Println("Title: ", strings.Title(strArr[i]))
  16. fmt.Println("ToLower then Title: ", strings.Title(strings.ToLower(strArr[i])))
  17. fmt.Println("-------------------------------")
  18. }
  19. }
  20.  
Success #stdin #stdout 0s 790016KB
stdin
Standard input is empty
stdout
 
Given Text:  title case
ToTitle:  TITLE CASE
ToUpper:  TITLE CASE
Title:  Title Case
ToLower then Title:  Title Case
-------------------------------
 
Given Text:  Title Case
ToTitle:  TITLE CASE
ToUpper:  TITLE CASE
Title:  Title Case
ToLower then Title:  Title Case
-------------------------------
 
Given Text:  TITLE CASE
ToTitle:  TITLE CASE
ToUpper:  TITLE CASE
Title:  TITLE CASE
ToLower then Title:  Title Case
-------------------------------
 
Given Text:  TiTlE CasE
ToTitle:  TITLE CASE
ToUpper:  TITLE CASE
Title:  TiTlE CasE
ToLower then Title:  Title Case
-------------------------------
 
Given Text:  Title case
ToTitle:  TITLE CASE
ToUpper:  TITLE CASE
Title:  Title Case
ToLower then Title:  Title Case
-------------------------------
 
Given Text:  title CASE
ToTitle:  TITLE CASE
ToUpper:  TITLE CASE
Title:  Title CASE
ToLower then Title:  Title Case
-------------------------------