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
+23.7k Golang : Convert long hexadecimal with strconv.ParseUint example
+6.4k Javascript : Push notifications to browser with Push.js
+6.6k Gogland : Single File versus Go Application Run Configurations
+9.3k Generate Random number with math/rand in Go
+5.5k Golang : Embedded or data bundling example
+9.8k Golang : How to determine a prime number?
+12.5k Golang : Human readable time elapsed format such as 5 days ago
+6.3k Golang : Check to see if *File is a file or directory
+14.4k Golang : Loop each day of the current month example
+14k Golang : Get digits from integer before and after given position example
+8.3k Golang : Find correlation coefficient example