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
+11.3k Golang : Fix - does not implement sort.Interface (missing Len method)
+9.1k Golang : How to use Gorilla webtoolkit context package properly
+12.7k Golang : Transform comma separated string to slice example
+5.4k Golang : How to deal with configuration data?
+12.9k Swift : Convert (cast) Int or int32 value to CGFloat
+18.1k Golang : Get all upper case or lower case characters from string example
+10.9k PHP : Convert(cast) bigInt to string
+9.5k Golang : Create unique title slugs example
+6k Unix/Linux : How to open tar.gz file ?
+8.7k Golang : Another camera capture GUI application with GTK and OpenCV
+13.7k Golang : Get user input until a command or receive a word to stop
+33.8k Golang : convert(cast) bytes to string