1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
DESCRIPTION
This is an alternative to String::Trim (and similar modules, see "SEE
ALSO"). Instead of a single trim function, this module provides several
from which you can choose on, depending on your needs.
FUNCTIONS
ltrim($str) => STR
Trim whitespaces (including newlines) at the beginning of string.
Equivalent to:
$str =~ s/\A\s+//s;
ltrim_lines($str) => STR
Trim whitespaces (not including newlines) at the beginning of each line
of string. Equivalent to:
$str =~ s/^\s+//mg;
rtrim($str) => STR
Trim whitespaces (including newlines) at the end of string. Equivalent
to:
$str =~ s/[ \t]+\z//s;
rtrim_lines($str) => STR
Trim whitespaces (not including newlines) at the end of each line of
string. Equivalent to:
$str =~ s/[ \t]+$//mg;
trim($str) => STR
ltrim + rtrim.
trim_lines($str) => STR
ltrim_lines + rtrim_lines.
trim_blank_lines($str) => STR
Trim blank lines at the beginning and the end. Won't trim blank lines
in the middle. Blank lines include lines with only whitespaces in them.
ellipsis($str[, $maxlen, $ellipsis]) => STR
Return $str unmodified if $str's length is less than $maxlen (default
80). Otherwise cut $str to ($maxlen - length($ellipsis)) and append
$ellipsis (default '...') at the end.
SEE ALSO
For trim functions: String::Trim, Text::Trim, String::Strip,
String::Util.
For ellipsis/eliding: Text::Elide (elide at word boundaries),
String::Elide::Parts (elide with more options).
|