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
+7.6k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+13.2k Golang : GUI with Qt and OpenCV to capture image from camera
+23k Golang : Call function from another package
+7.5k Golang : On lambda, anonymous, inline functions and function literals
+10.8k Golang : Determine if time variables have same calendar day
+14.8k Golang : Read a file line by line
+15k Golang : convert string or integer to big.Int type
+16.2k Golang : When to use init() function?
+17.6k Golang : Get host name or domain name from IP address
+8k Golang : Serving HTTP and Websocket from different ports in a program example
+7.2k Golang : Find relative luminance or color brightness
+16.2k Golang : Clone with pointer and modify value