al_ustr_dup_substr(3alleg5)
π al_ustr_dup_substr β Allegro 5 API π
okay bestie, welcome to the Allegro 5 manual, this one's from the allegro5 family of pages and it's giving "I just want a lil slice of my string, pls" energy. no cap. π
β¨ SYNOPSIS β¨
#include <allegro5/allegro.h>
ALLEGRO_USTR *al_ustr_dup_substr(const ALLEGRO_USTR *us, int start_pos,
int end_pos)
like, you feed it a string and two ints and it hands you back a whole new string. iconic behavior honestly. π¦
πΈ DESCRIPTION πΈ
So here's the tea β: al_ustr_dup_substr returns a new copy of a string, and this new copy contains the contents of us in the byte interval [start_pos, end_pos).
and yes, the interval is half-open β that bracket on the left is square, that paren on the right is round. so start_pos is included and end_pos is NOT included. it's giving "start is invited to the party, end is not". π
The new string will be NUL terminated β¨ (as all good strings should be), and β listen, this part matters β it will need to be freed with al_ustr_free(3alleg5). Not me forgetting to free my dup'd strings and leaking memory, couldn't be me π please free it. your valgrind will thank you. π
If necessary, use al_ustr_offset(3alleg5) to find the byte offsets for a given code point that you are interested in. because bestie, these are byte offsets, not code point offsets β they're not the same thing and the vibes get messy if you mix them up. go find your offset first, then come back here. π§
π SEE ALSO π
and that's the whole page, periodt. π this one lives in the Allegro reference manual, it's the al_ustr_dup_substr(3alleg5) page, and that's the whole vibe check. go forth and slice your strings responsibly, 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