al_ustr_next(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ al_ustr_next ✨

okay bestie, welcome to al_ustr_next from the Allegro 5 API β€” it's giving "let's find the next character" and honestly? iconic. πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

bool al_ustr_next(const ALLEGRO_USTR *us, int *pos)

πŸ¦‹ DESCRIPTION πŸ¦‹

so the whole vibe here is: you got a string us, you got a position pos pointing at some byte offset, and this function goes "okay bestie, where's the next code point at?" πŸ’–

It finds the byte offset of the next code point in the string, starting from *pos. And listen β€” *pos does not have to be sitting pretty at the beginning of a code point. It can be anywhere. No judgement. πŸ™ˆ

It returns true when it works out, and then the value that pos points to gets updated to the offset it found. Slay. ✨

But if *pos was already chilling at the end of the string? Then it returns false, and *pos stays exactly as it was. Unmodified. Untouched. Protected. 🫢

⚠️ okay important heads up: this function literally just hunts for an appropriate byte. That's it. It does not check whether the offset it found is actually the beginning of a valid code point. So if you're out here working with possibly invalid UTF-8 strings, it could skip right over some invalid bytes. Not its problem, not its business. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

  • al_ustr_prev(3alleg5) β€” for when you wanna go backwards instead. main character energy either way. πŸ”₯

and that's the whole page, no cap. πŸ’œ this was al_ustr_next, straight out of the Allegro reference manual, page al_ustr_next(3alleg5). go forth and find your next code point, bestie πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from