A Go library for measuring the display width of characters and strings, handling East Asian fullwidth characters.
go-runewidth is a Go library that measures the display width of characters and strings in terminal environments. It solves the problem of accurately formatting text output when dealing with mixed character sets, particularly East Asian fullwidth characters that occupy two terminal columns instead of one.
Go developers building command-line interfaces, terminal applications, or text formatting tools that need to handle international character sets correctly.
Developers choose go-runewidth because it provides a reliable, cross-platform implementation of character width measurement specifically for Go applications, ensuring proper text alignment and formatting in terminal outputs.
wcwidth for golang
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Correctly calculates display width for East Asian characters, as shown by the example where 'つのだ☆HIRO' equals 12 columns.
Implements wcwidth() for Go, ensuring reliable behavior across Unix-like systems for terminal applications.
Offers straightforward functions like StringWidth(), making it easy to use with minimal code, evidenced by the concise README example.
Project shows good health with continuous integration, test coverage, and up-to-date GoDoc, as indicated by the badges in the README.
Designed solely for terminal environments, so it's not suitable for GUI or web text rendering without significant adaptation.
The README provides only a basic example, forcing developers to consult GoDoc for full API understanding and advanced usage.
Focuses on width calculation only, lacking built-in support for text wrapping, alignment, or complex Unicode sequences like emoji.