Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
No::Worries::String(3)User Contributed Perl DocumentatioNo::Worries::String(3)

NAME
       No::Worries::String - string handling without worries

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.

FUNCTIONS
       This module provides the	following functions (none of them being
       exported	by default):

       string_bytefmt(NUMBER[, PRECISION])
	   return 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)
	   return a new	string with all	potentially non-printable characters
	   escaped; this includes ASCII	control	characters, non-7bit ASCII and
	   Unicode characters

       string_plural(STRING)
	   assuming that STRING	is an English noun, returns its	plural form

       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"

       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:

	   o   "align":	array reference	of alignment directions	(default:
	       "left");	possible values	are "left", "center" and "right"

	   o   "colsep": column	separator string (default: " | ")

	   o   "header": array reference of column headers (default: none)

	   o   "headsep": header separator (default: "=" or "-"	for MarkDown)

	   o   "indent": string	to prepend to each line	(default: "")

	   o   "markdown": return a MarkDown compatible	table

       string_trim(STRING)
	   return a new	string with leading and	trailing spaces	removed

SEE ALSO
       No::Worries.

AUTHOR
       Lionel Cons <http://cern.ch/lionel.cons>

       Copyright (C) CERN 2012-2019

perl v5.32.1			  2019-04-03		No::Worries::String(3)

NAME | SYNOPSIS | DESCRIPTION | FUNCTIONS | SEE ALSO | AUTHOR

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=No::Worries::String&sektion=3&manpath=FreeBSD+13.0-RELEASE+and+Ports>

home | help