String...::More(3pm)

πŸ“¦
version 0.03 Β· 4 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– String...::More(3pm) β€” aka String::Trim::More πŸ’–

okay bestie, gather round, because this is the String...::More(3pm) manual page and it's genuinely so useful it's giving main character energy. It's the user-contributed Perl documentation for a lil module called String::Trim::More, and it's about to make your whitespace problems ✨disappear✨.


🌸 VERSION 🌸

This doc describes version 0.03 of String::Trim::More (from the Perl distribution String-Trim-More), released on 2017-01-27. Yes she's an elder but she still slays πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: this module is an alternative to String::Trim (and friends β€” peep the SEE ALSO section, iykyk). The difference? Instead of one single trim function doing mystery-meat trimming, this module hands you several functions and lets you pick whichever one actually fits what you need. Choose your own adventure, bestie πŸŽ€


πŸ‘‘ FUNCTIONS πŸ‘‘

🌈 ltrim($str) => STR

Trims whitespaces (including newlines) from the beginning of the string. It's literally equivalent to:

$str =~ s/\A\s+//s;

🌈 ltrim_lines($str) => STR

Trims whitespaces (not including newlines) at the beginning of each line of the string. Equivalent to:

$str =~ s/^\s+//mg;

🌈 rtrim($str) => STR

Trims whitespaces (including newlines) at the end of the string. Equivalent to:

$str =~ s/[ \t]+\z//s;

🌈 rtrim_lines($str) => STR

Trims whitespaces (not including newlines) at the end of each line of the string. Equivalent to:

$str =~ s/[ \t]+$//mg;

🌈 trim($str) => STR

It's ltrim + rtrim. Both ends, one glow-up. πŸ’–

🌈 trim_lines($str) => STR

It's ltrim_lines + rtrim_lines. Every line gets the treatment. Periodt.

🌈 trim_blank_lines($str) => STR

Trims blank lines at the beginning and the end. She will not touch blank lines in the middle β€” those stay, no cap. And heads up: "blank lines" here includes lines that have only whitespaces in them. Empty-looking but not actually empty, sneaky little things πŸ™ˆ

🌈 ellipsis($str[, $maxlen, $ellipsis]) => STR

Returns $str totally unmodified if $str's length is less than $maxlen (default 80). Otherwise it cuts $str down to ($maxlen - length($ellipsis)) and tacks $ellipsis (default '...') onto the end. So dramatic. So concise. πŸ”₯


🫢 HOMEPAGE 🫢

Pls visit the project's homepage at <https://metacpan.org/release/String-Trim-More>. Go give it a lil look, it's iconic.


🧚 SOURCE 🧚

The source repository lives at <https://github.com/perlancar/perl-String-Trim-More>. Fork it, star it, treat it right ⭐


πŸ’€ BUGS πŸ’€

Found a bug? Got a feature request? Report it on the bugtracker website: <https://rt.cpan.org/Public/Dist/Display.html?Name=String-Trim-More>

And when you submit a bug or a request, please include a test-file β€” or a patch to an existing test-file β€” that actually illustrates the bug or the feature you want. No vague vibes, bestie, we need receipts πŸ“


πŸ’œ 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).

πŸ“ AUTHOR πŸ“

perlancar <perlancar@cpan.org> β€” the legend themself πŸ‘‘


This software is copyright (c) 2017 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Free as in go off, fr fr.


and that's the whole page, bestie!! πŸ’– This was String...::More(3pm) as documented for perl v5.34.0, dated 2022-06-17. Stay trimmed, stay slaying, and go touch some whitespace πŸŒΈβœ¨πŸ¦‹

πŸ“¦ where this page comes from