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
+36k Golang : Read a text file and replace certain words
+17k Golang : Iterating Elements Over A List
+5.7k Unix/Linux : How to fix CentOS yum duplicate glibc or device-mapper-libs dependency error?
+25k Golang : Convert file content into array of bytes
+2.6k Java : Get FX sentiment from website example
+3.5k Javascript : Detect when console is activated and do something about it
+5.9k Golang : Calculate BMI and risk category
+18.1k Golang : How to run your code only once with sync.Once object
+17.4k Golang : Check whether a network interface is up on your machine
+12.6k Golang : How to check if a file is hidden?
+10.5k Golang : Get remaining text such as id or filename after last segment in URL path
+12.6k Golang : Gin framework accept query string by post request example