Golang unicode.MaxLatin1 Constant with Examples

Golang | unicode.MaxLatin1 Constant: Here, we are going to learn about the MaxLatin1 constant of the unicode package with its usages, syntax, and examples.
Submitted by IncludeHelp, on September 15, 2021

unicode.MaxLatin1 Constant

The MaxLatin1 constant is an inbuilt constant of the unicode package which is used to get the maximum Latin-1 value. The value of MaxLatin1 constant is '\u00FF'.

Syntax:

int32 unicode.MaxLatin1

Parameter(s):

  • None

Return Value:

The return type of the unicode.MaxLatin1 constant is an int32, it returns the maximum Latin-1 value.

Example 1:

// Golang program to demonstrate the
// example of unicode.MaxLatin1 constant

package main

import (
	"fmt"
	"unicode"
)

func main() {
	fmt.Printf("Value of unicode.MaxLatin1: %U\n",
		unicode.MaxLatin1)
	fmt.Printf("Type of unicode.MaxLatin1: %T\n",
		unicode.MaxLatin1)
}

Output:

Value of unicode.MaxLatin1: U+00FF
Type of unicode.MaxLatin1: int32

Example 2:

// Golang program to demonstrate the
// example of unicode.MaxLatin1 constant

package main

import (
	"fmt"
	"unicode"
)

// creating function to return the
// value of MaxLatin1.
func getMaxLatin1() int32 {
	return unicode.MaxLatin1
}

func main() {
	fmt.Println("Value of unicode.MaxLatin1:",
		getMaxLatin1())

	// Print the value in Unicode format
	fmt.Printf("Value of unicode.MaxLatin1: %U",
		getMaxLatin1())
}

Output:

Value of unicode.MaxLatin1: 255
Value of unicode.MaxLatin1: U+00FF

Golang unicode Package »




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.