Skip to content

moznion/go-unicode-east-asian-width

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

go-unicode-east-asian-width

Provides width properties of East Asian Characters.
This package is port of Unicode::EastAsianWidth from Perl to Go.

https://godoc.org/github.com/moznion/go-unicode-east-asian-width

Getting Started

go get github.com/moznion/go-unicode-east-asian-width

Synopsis

import (
	"unicode"

	"github.com/moznion/go-unicode-east-asian-width"
)

func main() {
	eastasianwidth.IsFullwidth('世') // true
	eastasianwidth.IsHalfwidth('界') // false
	eastasianwidth.IsHalfwidth('w') // true

	unicode.Is(eastasianwidth.EastAsianWide, '禅') // true
}

Provided Variables

  • EastAsian bool

EastAsian is the flag for ambiguous character.
If this flag is true, ambiguous characters are treated as full width. Elsewise, ambiguous characters are treated as half width.
Default value is false.

  • EastAsianAmbiguous unicode.RangeTable
  • EastAsianFullwidth unicode.RangeTable
  • EastAsianHalfwidth unicode.RangeTable
  • EastAsianNarrow unicode.RangeTable
  • EastAsianNeutral unicode.RangeTable
  • EastAsianWide unicode.RangeTable
  • Fullwidth unicode.RangeTable
  • Halfwidth unicode.RangeTable

RangeTable for East Asian characters.

Functions

  • func Fullwidth() map[string]*unicode.RangeTable

Returns the map of RangeTable of full width East Asian characters.

  • func Halfwidth() map[string]*unicode.RangeTable

Returns the map of RangeTable of half width East Asian characters.

  • func IsFullwidth(r rune) bool

Reports whether the rune is in range of full width character of East Asian.

  • func IsHalfwidth(r rune) bool

Reports whether the rune is in range of half width character of East Asian.

See Also

LICENSE

MIT

About

Provides width properties of East Asian Characters

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages