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
+17.2k Golang : Generate thumbnails from images
+8.7k Golang : Sort and reverse sort a slice of integers
+12.1k Golang : Date and Time formatting
+6.4k Golang : Individual and total number of words counter example
+24.6k Mac/Linux and Golang : Fix bind: address already in use error
+28.7k Get client IP Address in Go
+7.1k Golang : Auto-generate reply email with text/template package
+37.8k Golang : Remove dashes(or any character) from string
+9.3k Golang : Generate 403 Forbidden to protect a page or prevent indexing by search engine
+9k Golang : Get escape characters \u form from unicode characters
+17.4k Golang : Check whether a network interface is up on your machine
+13.6k Golang : Adding XML attributes to xml data or use attribute to differentiate a common tag name