stralloc_starts(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_starts β€” bestie, is this string a prefix or not ✨

okay so this one's a lil function from the libowfat girlies, and she's literally just a yes-or-no girlie. no cap.


🌸 NAME 🌸

stralloc_starts β€” check if a string is a prefix of a stralloc πŸ’–


πŸŽ€ SYNTAX πŸŽ€

#include <libowfat/stralloc.h>

int stralloc_starts(stralloc* sa,const char* in);

that's it. that's the whole vibe. two args, one int, zero drama. πŸ¦‹


πŸ’… DESCRIPTION πŸ’…

okay so stralloc_starts returns 1 if the \0-terminated string in in β€” like, without the terminating \0, bestie, we're not counting the little guy β€” is a prefix of the string stored in sa.

otherwise? she returns 0. that's it. that's the whole thing. πŸ’€

⚠️ okay important one: sa must already be allocated. like, do not come to her with an unallocated sa, she will not be helping you, fr fr. this is not a maybe, this is a must. πŸ™ˆ

so like, think of it as: does sa start with in? if yes β†’ 1, if no β†’ 0. slay. πŸ‘‘


⭐ RETURN VALUE ⭐

  • 1 if in is a prefix of sa πŸ’š
  • 0 otherwise πŸ’”

no in-between, no "it depends", no "well actually". just the two. iconic behaviour, honestly. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

  • str_starts(3)

this page lives in the Library Functions Manual, and it's the stralloc_starts(3) girlie herself β€” that's the whole header/footer situation, no extra version or date tag along for the ride. anyway ily, go allocate your sa first, mwah πŸ’–πŸ’…πŸ«ΆπŸŒΈ