Categorygithub.com/mattn/go-runewidth
modulepackage
0.0.16
Repository: https://github.com/mattn/go-runewidth.git
Documentation: pkg.go.dev

# README

go-runewidth

Build Status Codecov GoDoc Go Report Card

Provides functions to get fixed width of the character or string.

Usage

runewidth.StringWidth("つのだ☆HIRO") == 12

Author

Yasuhiro Matsumoto

License

under the MIT License: http://mattn.mit-license.org/2013

# Functions

CreateLUT will create an in-memory lookup table of 557055 bytes for faster operation.
FillLeft return string filled in left by spaces in w cells.
FillRight return string filled in left by spaces in w cells.
IsAmbiguousWidth returns whether is ambiguous width or not.
IsEastAsian return true if the current locale is CJK.
IsNeutralWidth returns whether is neutral width or not.
NewCondition return new instance of Condition which is current locale.
RuneWidth returns the number of cells in r.
StringWidth return width as you can see.
Truncate return string truncated with w cells.
TruncateLeft cuts w cells from the beginning of the `s`.
Wrap return string wrapped with w cells.

# Variables

DefaultCondition is a condition in current locale.
EastAsianWidth will be set true if the current locale is CJK.
StrictEmojiNeutral should be set false if handle broken fonts.

# Structs

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