STRMTRIM(3pub)
π NAME π
strmtrim β the glow-up function that replaces multiple white spaces with single blanks inside a string β¨
It's giving "squish the extra spaces, keep the vibes". No cap.
π SYNOPSIS π
#include <publib.h>
char *strmtrim(char *str);
π¦ DESCRIPTION π¦
okay so bestie, here's the tea π: strmtrim goes through your string and replaces every run of whitespace characters with a single blank. That's it. That's the whole job. Iconic behaviour, honestly.
The whitespace it cares about is defined by isspace(3) β so whatever that says counts as whitespace, that's what gets collapsed. Periodt.
But listen, and this is important π: it will NOT touch leading and trailing whitespace. It only cleans up the middle. If you want the ends dealt with too, you gotta go grab strltrim(3) and strrtrim(3) for those. Different tools, different jobs, all of them slay. π
not me collapsing your internal spaces but leaving your edges exactly how you left them π boundary-respecting king behaviour fr fr
β¨ RETURN VALUE β¨
strmtrim returns the value of its argument. That's right, it hands you back your own pointer. Same string, same pointer, just tidier in the middle. Lowkey the most chill return value ever. π«Ά
π SEE ALSO π
the whole trim squad, assembled π
πΈ AUTHOR πΈ
Lars Wirzenius β lars.wirzenius@helsinki.fi
ty bestie for your service π
okay that's the whole page!! this one lives in the Publib collection, section 3pub of the C Programmer's Manual π go forth and collapse those spaces, you've got this, mwah πβ¨π¦
π¦ where this page comes from
- debian bookworm: publib-dev 0.40-3+b1 Β· BSD-2-Clause
- debian trixie: publib-dev 0.40-4 Β· BSD-2-Clause
- ubuntu jammy: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu noble: publib-dev 0.40-3build1 Β· BSD-2-Clause
- ubuntu questing: publib-dev 0.40-4
- ubuntu resolute: publib-dev 0.40-4build1 Β· BSD-2-Clause
- ubuntu stonking: publib-dev 0.40-4build1 Β· BSD-2-Clause
- Copyright (c) 1994-2006 Lars Wirzenius. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms