109 lines
3.1 KiB
HTML
109 lines
3.1 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of CharWidth</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>CharWidth</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-10-27<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Text::CharWidth - Get number of occupied columns of a string on terminal
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
use Text::CharWidth qw(mbwidth mbswidth mblen);
|
|
mbwidth(string);
|
|
mbswidth(string);
|
|
mblen(string);
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
This module supplies features similar as <B><A HREF="/cgi-bin/man/man2html?3+wcwidth">wcwidth</A></B>(3) and <B><A HREF="/cgi-bin/man/man2html?3+wcswidth">wcswidth</A></B>(3)
|
|
in C language.
|
|
<P>
|
|
|
|
Characters have its own width on terminal depending on locale.
|
|
For example, <FONT SIZE="-1">ASCII</FONT> characters occupy one column per character,
|
|
east Asian fullwidth characters (like Hiragana or Han Ideograph)
|
|
occupy two columns per character, and combining characters (apperaring
|
|
in <FONT SIZE="-1">ISO-8859-11</FONT> Thai, Unicode, and so on) occupy zero columns per
|
|
character. <B>mbwidth()</B> gives the width of the first character of
|
|
the given string and <B>mbswidth()</B> gives the width of the whole given
|
|
string.
|
|
<P>
|
|
|
|
The names of mbwidth and mbswidth came from ``multibyte'' versions
|
|
of wcwidth and wcswidth which are ``wide character'' versions.
|
|
<P>
|
|
|
|
<I>mblen(string)</I> returns number of bytes of the first character of the
|
|
string. Please note that a character may consist of multiple
|
|
bytes in multibyte encodings such as <FONT SIZE="-1">UTF-8,</FONT> EUC-JP, EUC-KR,
|
|
<FONT SIZE="-1">GB2312,</FONT> or Big5.
|
|
<P>
|
|
|
|
<I>mbwidth(string)</I> returns the width of the first character of the
|
|
string. <I>mbswidth(string)</I> returns the width of the whole string.
|
|
<P>
|
|
|
|
Parameters are to be given in locale encodings, not always in <FONT SIZE="-1">UTF-8.</FONT>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?5+locale">locale</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?3+wcwidth">wcwidth</A></B>(3), <B><A HREF="/cgi-bin/man/man2html?3+wcswidth">wcswidth</A></B>(3)
|
|
<A NAME="lbAF"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
|
|
|
|
Tomohiro <FONT SIZE="-1">KUBOTA,</FONT> <<A HREF="mailto:kubota@debian.org">kubota@debian.org</A>>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>COPYRIGHT AND LICENSE</H2>
|
|
|
|
|
|
|
|
Copyright 2003 by Tomohiro <FONT SIZE="-1">KUBOTA</FONT>
|
|
<P>
|
|
|
|
This library is free software; you can redistribute it and/or modify
|
|
it under the same terms as Perl itself.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">SEE ALSO</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">AUTHOR</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">COPYRIGHT AND LICENSE</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:58 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|