al_ustr_prev(3alleg5)
π al_ustr_prev β Allegro 5 API π
okay bestie, welcome to al_ustr_prev(3alleg5) from the Allegro reference manual β¨ this one's short and sweet and it's giving "rewind button for your UTF-8 string" π¦
πΈ SYNOPSIS πΈ
#include <allegro5/allegro.h>
bool al_ustr_prev(const ALLEGRO_USTR *us, int *pos)
β¨ DESCRIPTION β¨
so what it does: it finds the byte offset of the previous code point in the string, i.e. the one sitting before *pos. π
and here's the cute part β *pos does not have to be sitting at the beginning of a code point. she's flexible like that π
it returns true on success, and the value pointed to by pos gets updated to the found offset. glow-up complete β¨
otherwise β as in, if *pos was already at the end of the string β it returns false, and *pos is left unmodified. no touchy. π
π«Ά real talk though, bestie: this function just looks for an appropriate byte. it does not check whether the found offset is actually the beginning of a valid code point. so if you're working with possibly invalid UTF-8 strings, it could skip over some invalid bytes. no cap. π
π SEE ALSO π
that's the whole page, you ate it π go forth and iterate your strings backwards like the main character you are π
mwah π β brought to you by the Allegro reference manual, page al_ustr_prev(3alleg5), Allegro 5. byeee π¦β¨
π¦ 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