×

Golang Tutorial

Golang Reference

Golang Programs

Golang Practice

Golang Miscellaneous

Golang unicode.IsMark() Function with Examples

Golang | unicode.IsMark() Function: Here, we are going to learn about the IsMark() function of the unicode package with its usages, syntax, and examples.
Submitted by IncludeHelp, on September 17, 2021

unicode.IsMark()

The IsMark() function is an inbuilt function of the unicode package which is used to check whether the given rune r is a mark character (category M – the set of Unicode mark characters).

It accepts one parameter (r rune) and returns true if rune r is a mark character; false, otherwise.

Syntax

func IsMark(r rune) bool

Parameters

  • r : Rune type value to be checked whether it is a mark character or not.

Return Value

The return type of the unicode.IsMark() function is a bool, it returns true if rune r is a mark character; false, otherwise.

Example 1

// Golang program to demonstrate the
// example of unicode.IsMark() Function

package main

import (
	"fmt"
	"unicode"
)

func main() {
	// constant with mixed type runes
	const mixed = "5Ὂg̀9! ℃ᾭG"

	for _, c := range mixed {
		if unicode.IsMark(c) == true {
			fmt.Printf("%c is a Mark\n", c)
		} else {
			fmt.Printf("%c is not a Mark\n", c)
		}
	}
}

Output:

5 is not a Mark
Ὂ is not a Mark
g is not a Mark
̀ is a Mark
9 is not a Mark
! is not a Mark
  is not a Mark
℃ is not a Mark
ᾭ is not a Mark
G is not a Mark

Golang unicode Package »




Comments and Discussions!

Load comments ↻





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