No::Wor...::String(3)
πΈ NAME πΈ
No::Worries::String β string handling without worries. also hi bestie, this is the User Contributed Perl Documentation page for No::Wor...::String(3) π
β¨ SYNOPSIS β¨
use No::Worries::String qw(*);
# format a number of bytes
printf("%s has %s\n", $path, string_bytefmt(-s $path));
# escape a string
printf("found %s\n", string_escape($data));
# produce a nice output (e.g "1 file" or "3 files")
printf("found %s\n", string_quantify($count, "file"));
# format a table
print(string_table([
[1, 1, 1],
[2, 4, 8],
[3, 9, 27],
], header => [qw(x x^2 x^3)]));
# trim a string
$string = string_trim($input);
π DESCRIPTION π
This module eases string handling by providing convenient string manipulation functions. lowkey it's here to make your string life easier, no cap β¨
π FUNCTIONS π
okay so this module provides the following functions β and heads up, none of them are exported by default, so bestie you gotta import what you need π
π« string_bytefmt(NUMBER[, PRECISION]) π«
returns the given NUMBER formatted as a number of bytes, with a suffix such as "kB" or "GB" π. the default precision (i.e. number of digits after the decimal dot) is 2.
π¦ string_escape(STRING) π¦
returns a new string with all potentially non-printable characters escaped; this includes ASCII control characters, non-7bit ASCII and Unicode characters. so it's giving safe and readable β¨
πΈ string_plural(STRING) πΈ
assuming that STRING is an English noun, returns its plural form. simple as that π
π string_quantify(NUMBER, STRING) π
assuming that STRING is an English noun, returns a string saying how much of it there is; e.g. string_quantify(2, "foot") is "2 feet". iconic π
π string_table(TABLE[, OPTIONS]) π
transform the given table (a reference to an array of arrays of strings) into a formatted multi-line string; supported options:
alignβ array reference of alignment directions (default:"left"); possible values are"left","center"and"right".colsepβ column separator string (default:" | ").headerβ array reference of column headers (default: none).headsepβ header separator</headsep> (default:"="or"-"for MarkDown).indentβ string to prepend to each line (default:"").markdownβ return a MarkDown compatible table.
π§ string_trim(STRING) π§
returns a new string with leading and trailing spaces removed β bye whitespace ππ
π¦ SEE ALSO π¦
No::Worries.
π AUTHOR π
written by Lionel Cons <http://cern.ch/lionel.cons> π
Copyright (C) CERN 2012-2019
mwah π this page is from perl v5.32.1, dated 2021-10-18, and it's the No::Wor...::String(3) manual β bye bestie π«Ά
π¦ where this page comes from
- epel 9: perl-No-Worries 1.7-1.el9 Β· GPL+ or Artistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms