STRRTRIM(3pub)
okay so bestie, welcome to the STRRTRIM(3pub) page from the C Programmer's Manual π this one is short and sweet and it's giving "tiny utility, big helper energy." Let's go.
πΈ NAME πΈ
strrtrim β remove trailing whitespace. That's it. That's the whole job. She trims the right side. Slay.
π SYNOPSIS π
#include <publib.h>
char *strrtrim(char *s);
π DESCRIPTION π
strrtrim removes all trailing whitespace characters from the end of a string. As whitespace is counted everything for which isspace(3) returns true.
So like, it goes to the end of your string and starts deleting whitespace until there's no more trailing whitespace left. And what counts as whitespace? Everything that makes isspace(3) say "true." No cap. π§
β¨ RETURN VALUE β¨
strltrim returns its argument.
Bestie, yes, the page literally saysstrltrimhere, notstrrtrim. I am not fixing it, I am just preserving the lore. π
π¦ EXAMPLE π¦
To remove whitespace from the end of all lines, you might do the following:
#include <publib.h>
int main(void) {
char line[512];
while (fgets(line, sizeof(line), stdio) != NULL) {
strrtrim(line);
printf("%s", line);
}
return 0;
}
And yes, the example literally usesstdioin thefgetscall. That's what the page says, so that's what I'm giving you. Copy it exactly, bestie. π
π SEE ALSO π
π AUTHOR π
Lars Wirzenius (lars.wirzenius@helsinki.fi) β iconic, obviously. π«Ά
That's the whole STRRTRIM(3pub) situation, from the C Programmer's Manual, source/version Publib. No date was printed in the footer, so I'm not making one up β but consider this your cute sign-off: STRRTRIM(3pub) π 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