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
+11k Golang : Send data to /dev/null a.k.a blackhole with ioutil.Discard
+7.3k Python : Fix SyntaxError: Non-ASCII character in file, but no encoding declared
+25.3k Golang : Force your program to run with root permissions
+5k Golang : Detect variable or constant type
+10.2k Golang : Simple file scaning and remove virus example
+25.1k Golang : Encrypt and decrypt data with AES crypto
+11.6k Golang : Drop cookie to visitor's browser and http.SetCookie() example
+14.1k Golang : How do I get the local IP (non-loopback) address ?
+13.3k Golang : Convert(cast) int to float example
+7.7k Golang : Gonum standard normal random numbers example
+10.4k Golang : flag provided but not defined error