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.7k Mac OSX : Get a process/daemon status information
+10.1k Golang : "https://" not allowed in import path
+29.5k Golang : Validate IP address
+18.5k Golang : Sort and reverse sort a slice of strings
+7.1k Golang : Qt Yes No and Quit message box example
+14.7k Golang : How to get own program name during runtime ?
+5.1k Golang : Decode XML data from RSS feed
+5.6k Golang : Reverse text lines or flip line order example
+4.4k Golang : Find the longest line of text example
+9.7k Golang : Skip blank/empty lines in CSV file and trim whitespaces example
+16.6k Golang : Delete duplicate items from a slice/array
+9.7k Golang : Convert(cast) float to int