August 24, 2025
Change string in upper case with ToUpper function
You can convert a string into upper case (all letters in capital letters) with using of ToUpper function of string package. The example of ToUpper method is mentioned below:
Code
package main
import (
"fmt"
"strings"
)
func main() {
// Declare a string
greetingStr := "Good Morning"
result := strings.ToUpper(greetingStr);
// Convert to Uppercase
fmt.Println("Uppercase:", result)
}