SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.43.35 | ADMIN IP 216.73.216.180
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : mail
Current File : /opt/alt/alt-nodejs10/root/usr/lib/node_modules/npm/node_modules.bundled/string-width//readme.md
# string-width [](https://travis-ci.org/sindresorhus/string-width)
> Get the visual width of a string - the number of columns required to display it
Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) 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
```js
const stringWidth = require('string-width');
stringWidth('古');
//=> 2
stringWidth('\u001b[1m古\u001b[22m');
//=> 2
stringWidth('a');
//=> 1
```
## Related
- [string-width-cli](https://github.com/sindresorhus/string-width-cli) - CLI for this module
- [string-length](https://github.com/sindresorhus/string-length) - Get the real length of a string
- [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
| NAME |
SIZE |
LAST TOUCH |
USER |
CAN-I? |
FUNCTIONS |
| .. | -- | 3 Mar 2024 10.41 PM | root / root | 0755 | |
| node_modules | -- | 3 Mar 2024 10.41 PM | root / root | 0755 | |
| | | | | |
| index.js | 0.634 KB | 22 Mar 2023 10.59 AM | root / root | 0644 | |
| license | 1.083 KB | 22 Mar 2023 10.59 AM | root / root | 0644 | |
| package.json | 2.074 KB | 22 Mar 2023 10.59 AM | root / root | 0644 | |
| readme.md | 1.123 KB | 22 Mar 2023 10.59 AM | root / root | 0644 | |