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