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
+15.6k Golang : Get input from keyboard
+12.5k Golang : unknown escape sequence error
+17.2k Golang : Write file with io.WriteString
+15.5k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+7.5k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+3.9k Golang : Calculate a pip value and distance to target profit example
+23.4k Golang : convert rune to integer value
+5.6k Golang : Derive cryptographic key from passwords with Argon2
+14.9k Golang : convert string or integer to big.Int type
+6.9k Golang : Regular Expression find string example
+16.1k Golang : Multi threading or run two processes or more example
+4.4k Golang : If else example and common mistake