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 Golang : Calculate pivot points for a cross
+43.1k Golang : Convert []byte to image
+18.5k Golang : Generate thumbnails from images
+13.1k Golang : Convert(cast) int to int64
+7.6k Golang : Mapping Iban to Dunging alphabets
+5.7k Fix yum-complete-transaction error
+11.5k CodeIgniter : Import Linkedin data
+15.1k JavaScript/JQuery : Detect or intercept enter key pressed example
+8k Golang : Variadic function arguments sanity check example
+26.6k Golang : How to check if a connection to database is still alive ?
+5.4k Golang : If else example and common mistake