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
+35k Golang : Strip slashes from string example
+11k Golang : How to use if, eq and print properly in html template
+13.1k Golang : Verify token from Google Authenticator App
+28.7k Golang : Get first few and last few characters from string
+4.5k MariaDB/MySQL : Form select statement or search query with Chinese characters
+10.8k Golang : Create S3 bucket with official aws-sdk-go package
+12.4k Golang : Pass database connection to function called from another package and HTTP Handler
+7.3k Golang : How to handle file size larger than available memory panic issue
+19.2k Golang : How to count the number of repeated characters in a string?
+7.2k Golang : How to stop user from directly running an executable file?
+33.7k Golang : Proper way to set function argument default value
+18.3k Golang : Iterating Elements Over A List