Home »
Golang »
Golang Reference
Golang unicode.MaxRune Constant with Examples
Golang | unicode.MaxRune Constant: Here, we are going to learn about the MaxRune constant of the unicode package with its usages, syntax, and examples.
Submitted by IncludeHelp, on September 15, 2021
unicode.MaxRune Constant
The MaxRune constant is an inbuilt constant of the unicode package which is used to get the maximum valid Unicode code point. The value of MaxRune constant is '\U0010FFFF'.
Syntax
int32 unicode.MaxRune
Parameters
Return Value
The return type of the unicode.MaxRune constant is an int32, it returns the maximum valid Unicode code point value.
Example 1
// Golang program to demonstrate the
// example of unicode.MaxRune constant
package main
import (
"fmt"
"unicode"
)
func main() {
fmt.Printf("Value of unicode.MaxRune: %U\n",
unicode.MaxRune)
fmt.Printf("Type of unicode.MaxRune: %T\n",
unicode.MaxRune)
}
Output:
Value of unicode.MaxRune: U+10FFFF
Type of unicode.MaxRune: int32
Example 2
// Golang program to demonstrate the
// example of unicode.MaxRune constant
package main
import (
"fmt"
"unicode"
)
// creating function to return the
// value of MaxRune.
func getMaxRune() int32 {
return unicode.MaxRune
}
func main() {
fmt.Println("Value of unicode.MaxRune:",
getMaxRune())
// Print the value in Unicode format
fmt.Printf("Value of unicode.MaxRune: %U",
getMaxRune())
}
Output:
Value of unicode.MaxRune: 1114111
Value of unicode.MaxRune: U+10FFFF
Golang unicode Package »