Golang unicode.In() function example

package unicode

Golang unicode.In() function usage example. Use to check if a given rune is from within ranges of RangeTable.

 package main

 import (
 "fmt"
 "unicode"
 )

 var tab unicode.RangeTable

 func main() {

 memberShip := unicode.In('A', &tab)
 fmt.Println("A is a member of tab ? : ", memberShip)

 memberShip = unicode.In('界', unicode.Han)
 fmt.Println("界 is a member of unicode.Han ? : ", memberShip)
 }

Output :

A is a member of tab ? : false

界 is a member of unicode.Han ? : true

References :

http://golang.org/pkg/unicode/#RangeTable

http://golang.org/pkg/unicode/#In

Advertisement