stralloc_chop(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

πŸ’– stralloc_chop β€” the manual page, but make it cute πŸ’–

okay bestie, welcome to stralloc_chop(3) from the Library Functions Manual ✨ this one is short, sweet, and honestly iconic β€” she pops the last character off a string and hands it to you. no cap. πŸŽ€


🌸 NAME 🌸

stralloc_chop β€” remove and return last char 🫢


✨ SYNTAX ✨

lowkey just this, bestie:

#include <libowfat/stralloc.h>

int stralloc_chop(stralloc* sa);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the vibe: stralloc_chop removes the last char in the stralloc. that's it. that's the whole job. πŸ’…

and if the stralloc is empty? she simply does nothing and returns -1. not dramatic, just unbothered. πŸ™ˆ

the character she chops off gets cast to unsigned char and then returned to you. yes, cast to unsigned char β€” remember that part, it's giving "details matter". πŸ‘‘


🌈 RETURN VALUE 🌈

  • the chopped character πŸ“ β€” that's your girl, handed right back to you
  • or -1 if the string was empty πŸ’€ (nothing to chop, nothing to give)

πŸ‘€ SEE ALSO πŸ‘€

  • stralloc_chomp(3) β€” her sibling, the one who eats trailing newlines instead. iykyk. 🧚

and that's the page, bestie! this lil' gem lives in the Library Functions Manual and goes by stralloc_chop(3). go forth and chop responsibly. πŸ’œβœ¨