How to Convert a String in Lowercase in Golang?

In golang, you can convert strings into lower case by using the ToLower() function from the string package. It accepts strings as an argument and converts into lower case.

To use the ToLower() function you need to import the strings package into your go file. Below is the code that imports the strings package.

import (

Once a file has a strings package then you can convert the string into lower through the function. Let’s do it by following code,

strings.ToLower("Golang Tutorials")

This code converts the string into lower case but to see the output we need to use the Println() function.

fmt.Println(strings.ToLower("Golang Tutorials"))
// Output: golang tutorials

In this example, the ToLower() function converts string into lower case.

Related Posts

Tags: Golang, String,