1String::Trim::More(3) User Contributed Perl DocumentationString::Trim::More(3)
2
3
4
6 String::Trim::More - Various string trimming utilities
7
9 This document describes version 0.03 of String::Trim::More (from Perl
10 distribution String-Trim-More), released on 2017-01-27.
11
13 This is an alternative to String::Trim (and similar modules, see "SEE
14 ALSO"). Instead of a single "trim" function, this module provides
15 several from which you can choose on, depending on your needs.
16
18 ltrim($str) => STR
19 Trim whitespaces (including newlines) at the beginning of string.
20 Equivalent to:
21
22 $str =~ s/\A\s+//s;
23
24 ltrim_lines($str) => STR
25 Trim whitespaces (not including newlines) at the beginning of each line
26 of string. Equivalent to:
27
28 $str =~ s/^\s+//mg;
29
30 rtrim($str) => STR
31 Trim whitespaces (including newlines) at the end of string. Equivalent
32 to:
33
34 $str =~ s/[ \t]+\z//s;
35
36 rtrim_lines($str) => STR
37 Trim whitespaces (not including newlines) at the end of each line of
38 string. Equivalent to:
39
40 $str =~ s/[ \t]+$//mg;
41
42 trim($str) => STR
43 ltrim + rtrim.
44
45 trim_lines($str) => STR
46 ltrim_lines + rtrim_lines.
47
48 trim_blank_lines($str) => STR
49 Trim blank lines at the beginning and the end. Won't trim blank lines
50 in the middle. Blank lines include lines with only whitespaces in them.
51
52 ellipsis($str[, $maxlen, $ellipsis]) => STR
53 Return $str unmodified if $str's length is less than $maxlen (default
54 80). Otherwise cut $str to ($maxlen - length($ellipsis)) and append
55 $ellipsis (default '...') at the end.
56
58 Please visit the project's homepage at
59 <https://metacpan.org/release/String-Trim-More>.
60
62 Source repository is at
63 <https://github.com/perlancar/perl-String-Trim-More>.
64
66 Please report any bugs or feature requests on the bugtracker website
67 <https://rt.cpan.org/Public/Dist/Display.html?Name=String-Trim-More>
68
69 When submitting a bug or request, please include a test-file or a patch
70 to an existing test-file that illustrates the bug or desired feature.
71
73 For trim functions: String::Trim, Text::Trim, String::Strip,
74 String::Util.
75
76 For ellipsis/eliding: Text::Elide (elide at word boundaries),
77 String::Elide::Parts (elide with more options).
78
80 perlancar <perlancar@cpan.org>
81
83 This software is copyright (c) 2017 by perlancar@cpan.org.
84
85 This is free software; you can redistribute it and/or modify it under
86 the same terms as the Perl 5 programming language system itself.
87
88
89
90perl v5.34.0 2022-01-21 String::Trim::More(3)