stralloc_chomp(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ NAME ✨

okay bestie, say hi to stralloc_chomp β€” the little function whose whole personality is removing trailing CR, LF or CRLF πŸ’…


🌸 SYNTAX 🌸

so here's how you summon her:

#include <libowfat/stralloc.h>

int stralloc_chomp(stralloc* sa);

yeah. one include, one function call, that's it. no cap. 🫢


πŸŽ€ DESCRIPTION πŸŽ€

okay so picture this: you've got your sa (a stralloc*, obviously), and she's got some crusty line-ending junk hanging off the end of her. stralloc_chomp is the friend who comes in and gently yeets it off. 🧹✨

She removes a trailing CRLF, CR or LF from sa, and then β€” because she's a giver β€” she hands you back the number of removed characters (i.e. 0, 1 or 2).

the way she literally tells you exactly how much she took off?? obsessed. it's giving "I cleaned up AND I gave you a receipt". πŸ”₯


πŸ’– RETURN VALUE πŸ’–

she returns the number of removed characters (0, 1, or 2).

that's it. that's the whole vibe check. if she returns 0 she didn't find anything to chomp, and honestly? respect the honesty. 😌


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie!! this was stralloc_chomp(3) from the Library Functions Manual β€” aka the libowfat crew's finest. mwah, go chomp some line endings, ily πŸ’œπŸŒΈ