eastasianwidth

package module
v0.0.0-...-0231aeb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2014 License: MIT Imports: 1 Imported by: 6

README

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EastAsian = false

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`.

View Source
var EastAsianAmbiguous = _EastAsianAmbiguous

EastAsianAmbiguous is the unicode.RangeTable for East Asian ambiguous characters

View Source
var EastAsianFullwidth = _EastAsianFullwidth

EastAsianFullwidth is the unicode.RangeTable for East Asian full width characters

View Source
var EastAsianHalfwidth = _EastAsianHalfwidth

EastAsianHalfwidth is the unicode.RangeTable for East Asian half width characters

View Source
var EastAsianNarrow = _EastAsianNarrow

EastAsianNarrow is the unicode.RangeTable for East Asian narrow characters

View Source
var EastAsianNeutral = _EastAsianNeutral

EastAsianNeutral is the unicode.RangeTable for East Asian neutral characters

View Source
var EastAsianWide = _EastAsianWide

EastAsianWide is the unicode.RangeTable for East Asian wide characters

Functions

func Fullwidth

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

Fullwidth returns the map of unicode.RangeTable of full width East Asian characters

func Halfwidth

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

Halfwidth returns the map of unicode.RangeTable of half width East Asian characters

func IsFullwidth

func IsFullwidth(char rune) bool

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

func IsHalfwidth

func IsHalfwidth(char rune) bool

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

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL