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
+9.9k Random number generation with crypto/rand in Go
+5.8k Unix/Linux/MacOSx : Get local IP address
+8.3k Golang : HttpRouter multiplexer routing example
+7.4k Golang : alternative to os.Exit() function
+22.2k Golang : Repeat a character by multiple of x factor
+6.4k Golang : Extract sub-strings
+6.2k Golang : Grab news article text and use NLP to get each paragraph's sentences
+43.5k Golang : Convert []byte to image
+7.8k Golang : Convert(cast) io.Reader type to string
+48.7k Golang : Upload file from web browser to server
+20.3k Golang : Reset or rewind io.Reader or io.Writer
+11.8k Golang : Find age or leap age from date of birth example