String::Trim::More(3pm)

String::Trim::More3pm

Various string trimming utilities

Version

This document describes version 0.03 of String::Trim::More (from Perl distribution String-Trim-More), released on 2017-01-27.

Overview

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.

Homepage

Please visit the project's homepage at <https://metacpan.org/release/String-Trim-More>.

Source

Source repository is at <https://github.com/perlancar/perl-String-Trim-More>.

Releases

5 releases since Debian 9 (Stretch); the text changed 3 times.

  1. 9
  2. 10
  3. 11
  4. 12–13

Bugs

Please report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=String-Trim-More>

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

Author

perlancar <[email protected]>

From libstring-trim-more-perl 0.03-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.