2020-03-04 23:26:01 -08:00
|
|
|
---
|
|
|
|
|
title: efuns / strings / strlen
|
|
|
|
|
---
|
2023-11-25 09:50:24 -08:00
|
|
|
# strwidth
|
2020-03-04 23:26:01 -08:00
|
|
|
|
|
|
|
|
### NAME
|
|
|
|
|
|
|
|
|
|
strwidth() - returns the display width of a string
|
|
|
|
|
|
|
|
|
|
### SYNOPSIS
|
|
|
|
|
|
|
|
|
|
int strwidth( string str );
|
|
|
|
|
|
|
|
|
|
### DESCRIPTION
|
|
|
|
|
|
|
|
|
|
strwidth() returns the number of columns to display string 'str'.
|
|
|
|
|
|
2022-09-02 21:48:01 -04:00
|
|
|
The driver uses rules defined in https://www.unicode.org/reports/tr11/tr11-36.html
|
|
|
|
|
to calcuate character width.
|
|
|
|
|
|
|
|
|
|
Control characters have no width. Wide characters, including emojis are two
|
|
|
|
|
columns wide. This rule is also used by sprintf() to layout strings.
|
2020-03-04 23:26:01 -08:00
|
|
|
|
|
|
|
|
### SEE ALSO
|
|
|
|
|
|
|
|
|
|
strlen()
|
|
|
|
|
|