1CharWidth(3) User Contributed Perl Documentation CharWidth(3)
2
3
4
6 Text::CharWidth - Get number of occupied columns of a string on
7 terminal
8
10 use Text::CharWidth qw(mbwidth mbswidth mblen);
11 mbwidth(string);
12 mbswidth(string);
13 mblen(string);
14
16 This module supplies features similar as wcwidth(3) and wcswidth(3) in
17 C language.
18
19 Characters have its own width on terminal depending on locale. For
20 example, ASCII characters occupy one column per character, east Asian
21 fullwidth characters (like Hiragana or Han Ideograph) occupy two
22 columns per character, and combining characters (apperaring in
23 ISO-8859-11 Thai, Unicode, and so on) occupy zero columns per
24 character. mbwidth() gives the width of the first character of the
25 given string and mbswidth() gives the width of the whole given string.
26
27 The names of mbwidth and mbswidth came from "multibyte" versions of
28 wcwidth and wcswidth which are "wide character" versions.
29
30 mblen(string) returns number of bytes of the first character of the
31 string. Please note that a character may consist of multiple bytes in
32 multibyte encodings such as UTF-8, EUC-JP, EUC-KR, GB2312, or Big5.
33
34 mbwidth(string) returns the width of the first character of the string.
35 mbswidth(string) returns the width of the whole string.
36
37 Parameters are to be given in locale encodings, not always in UTF-8.
38
40 locale(5), wcwidth(3), wcswidth(3)
41
43 Tomohiro KUBOTA, <kubota@debian.org>
44
46 Copyright 2003 by Tomohiro KUBOTA
47
48 This library is free software; you can redistribute it and/or modify it
49 under the same terms as Perl itself.
50
51
52
53perl v5.32.0 2020-07-28 CharWidth(3)