strnchr(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… strnchr(9) β€” the Kernel API Manual page you didn't know you needed

okay bestie, so this is the Kernel API Manual page for strnchr, and it's literally the little function that finds a character inside a string but only looks at the first count characters. no cap, it's giving "search but make it bounded" and honestly? we stan a cautious queen. πŸŽ€


✨ SYNOPSIS ✨

char * strnchr (const char *s , size_t count , int c );

like, that's the whole vibe right there. three arguments, one pointer returned. slay. πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • s β€” the string you're searching through. bestie, this is your haystack. πŸ”
  • count β€” how many characters you're actually allowed to look at. not one more, not one less. respect the boundary. βœ‹
  • c β€” the character you're looking for. the one. the main character of this search. πŸ‘‘

🌸 DESCRIPTION 🌸

so here's the tea: the NUL-terminator is considered part of the string, and you can absolutely search for it. like, it's not off-limits. it's invited to the party too. πŸŽ‰ so if you're looking for '\0', go off β€” strnchr will find it and won't even side-eye you for it. 🫢

fr fr, don't forget that detail. the NUL terminator is valid search bait. iykyk. πŸ’€

🧚 SEE ALSO 🧚

like, that's the whole friend group right there. the string-and-memory function squad. iconic. 🌈


sign-off bestie style: this little gem lives in ./lib, and it's stamped October 2026 β€” so yeah, it's current, it's cute, and it's strnchr(9). periodt. πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from