In Go, you can convert a string to uppercase or lowercase using strings.ToUpper() and strings.ToLower():
s := "Hello World"
upper := strings.ToUpper(s)
// upper == "HELLO WORLD"
lower := strings.ToLower(s)
// lower == "hello world"
strings.ToUpper converts all characters to uppercase, and strings.ToLower converts all characters to lowercase.
Assignment
Follow the Coding Tutorial and create upper and lower versions of word!
Hint
Use strings.ToUpper(word) for uppercase and strings.ToLower(word) for lowercase.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
