al_ustr_next(3alleg5)
β¨ 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
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms