Open In App
Related Articles

How to Map a Rune to Uppercase in Golang?

Improve Article
Save Article
Like Article

Rune is a superset of ASCII or it is an alias of int32. It holds all the characters available in the world’s writing system, including accents and other diacritical marks, control codes like tab and carriage return, and assigns each one a standard number. This standard number is known as a Unicode code point or rune in the Go language.
You are allowed to map the given rune into the upper case with the help of ToUpper() function. This function changes the case of the given rune(if the case of the rune is lower or title) into upper case and if the given rune is already present in upper case, then this function does nothing. This function is defined under Unicode package, so for accessing this method you need to import the Unicode package in your program.


func ToUpper(r rune) rune


// Go program to illustrate how to
// Map a rune to Uppercase
package main
import (
// Main function
func main() {
    // Creating rune
    rune_1 := 'G'
    rune_2 := 'e'
    rune_3 := 'E'
    rune_4 := 'k'
    // Mapping the given rune
    // into upper case
    // Using ToUpper() function
    fmt.Printf("Result 1: %c ", unicode.ToUpper(rune_1))
    fmt.Printf("\nResult 2: %c ", unicode.ToUpper(rune_2))
    fmt.Printf("\nResult 3: %c ", unicode.ToUpper(rune_3))
    fmt.Printf("\nResult 4: %c ", unicode.ToUpper(rune_4))
    fmt.Printf("\nResult 5: %c ", unicode.ToUpper('s'))


Result 1: G 
Result 2: E 
Result 3: E 
Result 4: K 
Result 5: S 
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 27 Sep, 2019
Like Article
Save Article
Similar Reads