In Golang, you can convert a string to lowercase using the strings
package which provides a ToLower
function. Here's an example:
package main
import (
"fmt"
"strings"
)
func main() {
str := "HELLO WORLD"
// Convert to lowercase
str = strings.ToLower(str)
fmt.Println(str) // Output: hello world
}
In this example, strings.ToLower
function is used to convert the string HELLO WORLD
to lowercase. The resulting lowercase string is then printed.