Golang : Strings to lowercase and uppercase example
A quick and short tutorial on how to change uppercase characters to lower case and vice-versa. If you string value is in byte format, please refer to https://www.socketloop.com/references/golang-bytes-tolower-function-example and https://www.socketloop.com/references/golang-bytes-toupper-function-example
package main
import (
"fmt"
"strings"
)
func main() {
upperStr := "ABCDEF"
fmt.Println(strings.ToLower(upperStr))
lowerStr := "wxyz"
fmt.Println(strings.ToUpper(lowerStr))
}
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+6.9k Golang : Find the longest line of text example
+7.2k Golang : Gorrila mux.Vars() function example
+16k Golang : Get digits from integer before and after given position example
+7.9k Golang : Getting Echo framework StartAutoTLS to work
+9.5k Golang : How to get username from email address
+16.7k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+17.1k Golang : Get number of CPU cores
+5.7k Golang : Configure crontab to poll every two minutes 8am to 6pm Monday to Friday
+18.6k Golang : Write file with io.WriteString
+6.4k Golang : Test input string for unicode example
+19.9k Golang : Append content to a file
+16.6k Golang : How to implement two-factor authentication?