Catman...x::trim(3pm)
π NAME π
Catmandu::Fix::trim β okay bestie, this one is literally just a little glow-up for your field values: it trims the leading and ending junk off them. That's it. That's the whole gig. β¨
β¨ SYNOPSIS β¨
Lowkey the easiest syntax ever, no cap. Watch:
# the default mode trims whitespace
# e.g. foo => ' abc ';
trim(foo) # foo => 'abc';
trim(foo, whitespace) # foo => 'abc';
# trim non-word characters
# e.g. foo => ' abc / : .';
trim(foo, nonword) # foo => 'abc';
# trim accents
# e.g. foo => 'franΓ§ais' ;
trim(foo,diacritics) # foo => 'francais'
So like, mode one β the default β is giving "whitespace" and it trims whitespace off both ends. trim(foo) and trim(foo, whitespace) do the exact same thing, she's flexible like that. π
Mode two is nonword, and she eats all the non-word characters hanging around the edges β slashes, colons, dots, all of it. The way that ' abc / : .' becomes 'abc'?? Iconic behaviour. π
Mode three is diacritics, and she strips the accents so 'franΓ§ais' turns into 'francais'. Normalising your Unicode like a main character. π¦
πΈ SEE ALSO πΈ
Catmandu::Fixβ the mothership, go say hi π«Ά
π fr fr, that's the entire page, I'm not even joking. Short king behaviour but she does her job.
Mwah, mwah, mwah β this lil' cutie is documented by the User Contributed Perl Documentation girlies, running on perl v5.40.1, last touched 2026-01-24. Slay, bestie, go trim something. πβ¨π·
π¦ where this page comes from
- ubuntu resolute: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-perl 1.2025-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms