go-runewidth: github.com/mattn/go-runewidth Index | Files

package runewidth

import "github.com/mattn/go-runewidth"

Index

Package Files

runewidth.go runewidth_posix.go

Variables

var (
    // EastAsianWidth will be set true if the current locale is CJK
    EastAsianWidth bool

    // ZeroWidthJoiner is flag to set to use UTR#51 ZWJ
    ZeroWidthJoiner bool

    // DefaultCondition is a condition in current locale
    DefaultCondition = &Condition{}
)

func FillLeft Uses

func FillLeft(s string, w int) string

FillLeft return string filled in left by spaces in w cells

func FillRight Uses

func FillRight(s string, w int) string

FillRight return string filled in left by spaces in w cells

func IsAmbiguousWidth Uses

func IsAmbiguousWidth(r rune) bool

IsAmbiguousWidth returns whether is ambiguous width or not.

func IsEastAsian Uses

func IsEastAsian() bool

IsEastAsian return true if the current locale is CJK

func IsNeutralWidth Uses

func IsNeutralWidth(r rune) bool

IsNeutralWidth returns whether is neutral width or not.

func RuneWidth Uses

func RuneWidth(r rune) int

RuneWidth returns the number of cells in r. See http://www.unicode.org/reports/tr11/

func StringWidth Uses

func StringWidth(s string) (width int)

StringWidth return width as you can see

func Truncate Uses

func Truncate(s string, w int, tail string) string

Truncate return string truncated with w cells

func Wrap Uses

func Wrap(s string, w int) string

Wrap return string wrapped with w cells

type Condition Uses

type Condition struct {
    EastAsianWidth  bool
    ZeroWidthJoiner bool
}

Condition have flag EastAsianWidth whether the current locale is CJK or not.

func NewCondition Uses

func NewCondition() *Condition

NewCondition return new instance of Condition which is current locale.

func (*Condition) FillLeft Uses

func (c *Condition) FillLeft(s string, w int) string

FillLeft return string filled in left by spaces in w cells

func (*Condition) FillRight Uses

func (c *Condition) FillRight(s string, w int) string

FillRight return string filled in left by spaces in w cells

func (*Condition) RuneWidth Uses

func (c *Condition) RuneWidth(r rune) int

RuneWidth returns the number of cells in r. See http://www.unicode.org/reports/tr11/

func (*Condition) StringWidth Uses

func (c *Condition) StringWidth(s string) (width int)

StringWidth return width as you can see

func (*Condition) Truncate Uses

func (c *Condition) Truncate(s string, w int, tail string) string

Truncate return string truncated with w cells

func (*Condition) Wrap Uses

func (c *Condition) Wrap(s string, w int) string

Wrap return string wrapped with w cells

Package runewidth imports 3 packages (graph) and is imported by 463 packages. Updated 2018-12-21. Refresh now. Tools for package owners.