-
-
05 Aug 2022 21:46:24 UTC
- Distribution: Text-ANSI-Fold-Util
- Module version: 0.07
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (207 / 0 / 1)
- Kwalitee
Bus factor: 1- 98.41% Coverage
- License: perl_5
- Perl: v5.14.0
- Activity
24 month- Tools
- Download (10.64KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Kazumasa Utashiro
NAME
Text::ANSI::Fold::Util - Text::ANSI::Fold utilities (width, substr)
SYNOPSIS
use Text::ANSI::Fold::Util qw(:all); use Text::ANSI::Fold::Util qw(ansi_width ansi_substr); ansi_width($text); ansi_substr($text, $offset, $width [, $replacement]); use Text::ANSI::Fold::Util; Text::ANSI::Fold::Util::width($text); Text::ANSI::Fold::Util::substr($text, ...); # ansi_expand() was moved to Text::ANSI::Tabs ansi_expand($text); Text::ANSI::Fold::Util::expand($text);
VERSION
Version 0.07
DESCRIPTION
This is a collection of utilities using Text::ANSI::Fold module. All functions are aware of ANSI terminal sequence.
FUNCTION
There are exportable functions start with ansi_ prefix, and unexportable functions without them.
- width(text)
- ansi_width(text)
-
Returns visual width of given text.
- substr(text, offset, width [, replacement])
- ansi_substr(text, offset, width [, replacement])
-
Returns substring just like Perl's substr function, but string position is calculated by the visible width on the screen instead of number of characters.
If an optional replacement parameter is given, replace the substring by the replacement and return the entire string.
It does not cut the text in the middle of multi-byte character, of course. Its behavior depends on the implementation of lower module.
- expand(text, ...)
- ansi_expand(text, ...)
-
This function is now moved to Text::ANSI::Tabs module. Interface remains only for backward compatibility, and may be deprecated in the future.
SEE ALSO
Text::ANSI::Fold::Util, https://github.com/kaz-utashiro/Text-ANSI-Fold-Util
Text::ANSI::Fold::Tabs, https://github.com/kaz-utashiro/Text-ANSI-Fold-Tabs
Text::ANSI::Fold, https://github.com/kaz-utashiro/Text-ANSI-Fold
LICENSE
Copyright 2020-2021 Kazumasa Utashiro.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Kazumasa Utashiro
Module Install Instructions
To install Text::ANSI::Fold::Util, copy and paste the appropriate command in to your terminal.
cpanm Text::ANSI::Fold::Util
perl -MCPAN -e shell install Text::ANSI::Fold::Util
For more information on module installation, please visit the detailed CPAN module installation guide.