How to Map a Rune to the Specified Case in Golang? Last Updated : 27 Sep, 2019 Comments Improve Suggest changes Like Article Like Report 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 a rune to the specified case with the help of To() function. This function changes the case of the given rune into lower case, or upper case, or title case according to your requirement. If the given rune is already present in the specified 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. Syntax: func To(_case int, r rune) rune Example 1: C // Go program to illustrate how to // map a rune to the specified case package main import ( "fmt" "unicode" ) // Main function func main() { // Creating rune rune_1 := 'g' rune_2 := 'e' // Mapping the given rune // into the specified case // Using To() function fmt.Printf("Result 1: %c ", unicode.To(unicode.UpperCase, rune_1)) fmt.Printf("\nResult 2: %c ", unicode.To(unicode.TitleCase, rune_2)) } Output: Result 1: G Result 2: E Example 2: C // Go program to illustrate how to // map a rune to the specified case package main import ( "fmt" "unicode" ) // Main function func main() { // Creating rune rune_1 := 'E' rune_2 := 'K' // Mapping the given rune // into the specified case // Using To() function fmt.Printf("\nResult 1: %c ", unicode.To(unicode.LowerCase, rune_1)) fmt.Printf("\nResult 2: %c ", unicode.To(unicode.TitleCase, rune_2)) fmt.Printf("\nResult 3: %c ", unicode.To(unicode.UpperCase, 's')) } Output: Result 1: e Result 2: K Result 3: S Comment More infoAdvertise with us Next Article How to check the specified rune in Golang String? A ankita_saini Follow Improve Article Tags : Go Language Golang Similar Reads How to Map a Rune to Title Case in Golang? 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 c 2 min read How to check the specified rune in Golang String? In Go language, strings are different from other languages like Java, C++, Python, etc. It is a sequence of variable-width characters where each and every character is represented by one or more bytes using UTF-8 Encoding. In the Go strings, you are allowed to check the given string contain the spec 3 min read How to Get the String in Specified Base in Golang? Go language provides inbuilt support to implement conversions to and from string representations of basic data types by strconv Package. This package provides a FormatInt() function which is used to return the string representation of x in the given base, i.e., 2 <= base <= 36. Here, the resul 2 min read How to Map a Rune to Lowercase in Golang? 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 c 2 min read How to Map a Rune to Uppercase in Golang? 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 c 2 min read How to copy a map to another map in Golang? Maps in Golang is a collection of unordered pairs of key-value. It is widely used because it provides fast lookups and values that can retrieve, update, or delete with the help of keys. In Map, you can copy a map to another map using the for loop provided by the Go language. In for loop, we fetch th 2 min read Like