Popularity
3.8
Growing
Activity
5.6
-
446
12
28

Monthly Downloads: 0
Programming language: JavaScript
License: MIT License
Tags: Ansi     Command Line Utilities     Unicode     String     Console     Str     Terminal     CLI     Character     Column     Fixed-width     Korean     Japanese     Chinese     Cjk     Command-line     Char     Codes     Escape     Full     Full-width     Fullwidth     Columns     Visual     Width    
Latest version: v4.2.0

string-width alternatives and similar modules

Based on the "Command Line Utilities" category.
Alternatively, view string-width alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of string-width or a related project?

Add another 'Command Line Utilities' Module

README

string-width

Get the visual width of a string - the number of columns required to display it

Some Unicode characters are fullwidth and use double the normal width. ANSI escape codes are stripped and doesn't affect the width.

Useful to be able to measure the actual width of command-line output.

Install

$ npm install string-width

Usage

import stringWidth from 'string-width';

stringWidth('a');
//=> 1

stringWidth('叀');
//=> 2

stringWidth('\u001B[1m叀\u001B[22m');
//=> 2

Related


Get professional support for this package with a Tidelift subscription Tidelift helps make open source sustainable for maintainers while giving companiesassurances about security, maintenance, and licensing for their dependencies.