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

✨ byte_rchr(3) ✨

okay so bestie, we're in the Library Functions Manual today and the function on the menu is byte_rchr πŸ’… come sit with me


🌸 NAME 🌸

byte_rchr β€” searching for a byte inside a string, but like… from the back πŸ¦‹


πŸŽ€ SYNTAX πŸŽ€

#include <libowfat/byte.h>

size_t byte_rchr(const char *haystack,size_t len,char needle);

yes the header is libowfat/byte.h, no you can't skip it, the compiler WILL throw hands 😭


πŸ’– DESCRIPTION πŸ’–

byte_chr returns the largest integer i between 0 and len-1 inclusive such that one[i] equals needle. πŸ‘‘

if no such integer exists, byte_chr returns len. periodt.

also real talk β€” byte_rchr may read all bytes one[0], one[1], ..., one[len-1], even if not all the bytes are relevant to the answer. it's giving "reads the whole group chat even though you only needed one message" πŸ“–βœ¨

not me noticing the original page says byte_chr in these lines when the whole page is literally byte_rchr… anyway iykyk, i'm just the messenger 🫢

🌈 SEE ALSO 🌈


that's the whole page bestie, short and iconic fr fr 🌸 this was byte_rchr(3) from the Library Functions Manual β€” no date on this one, she's timeless, main character energy only πŸ‘‘βœ¨πŸ’