How to capitalize all words in a string with Go

1 Answer

0 votes
package main

import (
    "fmt"
    "strings"
)

func main() {
    s := "the go programming language"
    
    s = strings.Title(strings.ToLower(s))

    fmt.Println(s)
}



/*
run:

The Go Programming Language

*/

 



answered Feb 1, 2025 by avibootz
...