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
+10.2k Golang : Bcrypting password
+27.3k Golang : Find files by name - cross platform example
+6.3k Golang : How to get capacity of a slice or array?
+11.7k Golang : Calculations using complex numbers example
+7k Golang : How to solve "too many .rsrc sections" error?
+12.1k Golang : Decompress zlib file example
+52.6k Golang : How to get struct field and value by name
+8.7k Golang : Set or add headers for many or different handlers
+9.4k Golang : How to protect your source code from client, hosting company or hacker?
+14k Golang : convert rune to unicode hexadecimal value and back to rune character
+16k Golang : Get sub string example
+7.1k Golang : Get Alexa ranking data example