SDL_strchr(3)

✨ NAME ✨

SDL_strchr β€” bestie, this is the one that searches a string for the first instance of a specific byte πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_stdinc.h>

char * SDL_strchr(const char *str, int c);

πŸ’… DESCRIPTION πŸ’…

okay so here's the vibe: you hand it a string, it goes looking, and it stops the second it finds the byte you asked for β€” or the second it hits a null terminator byte, which is the string saying "that's it, we're done here" πŸ›‘

⚠️ and this is the important part, bestie, do not skip this: it looks for bytes, not characters. so if you're trying to match a Unicode codepoint that's > 255, it's not gonna happen β€” doesn't matter what character encoding you're rolling with. it's giving byte-level only, periodt πŸ’€

🫢 FUNCTION PARAMETERS 🫢

  • str β€” the string to search. Must not be NULL. like, actually must not. no cap πŸ™ˆ
  • c β€” the byte value to search for ✨

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns a pointer to the first instance of c in the string, or NULL if it's not found 🌈

so if you get NULL back, that byte simply was not there. she looked. she didn't find it. respect the process πŸ’œ


🧚 THREAD SAFETY 🧚

It is safe to call this function from any thread πŸŽ‰ go off, multithreaded queen, no locking drama here πŸ’…


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0 πŸ¦‹


and that's the whole page, bestie!! literally iconic behavior from a tiny little byte-searcher πŸ“ this was SDL_strchr(3) from the SDL3 FUNCTIONS crew β€” brought to you by Simple Directmedia Layer, version SDL 3.4.18 πŸ’– mwah, go find your bytes πŸ‘‘

πŸ“¦ where this page comes from