al_ustr_assign_substr(3alleg5)

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

πŸ’– NAME πŸ’–

al_ustr_assign_substr β€” ok bestie, this is a lil slice of the Allegro 5 API (you'll see it filed under the manual name 3alleg5, that's just how we roll around here) 🌸


✨ SYNOPSIS ✨

#include <allegro5/allegro.h>

bool al_ustr_assign_substr(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2,
   int start_pos, int end_pos)

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: this function overwrites the string us1 with the contents of us2, but only the chunk living in the byte interval [start_pos, end_pos). Yes, that's a half-open interval, the end_pos byte itself is not included, we respect the bracket notation in this house πŸ’…

Both of those end points get clamped to the bounds of us2, so if you're feeling feral with your numbers, the function just reels them back in for you. No cap.

Lowkey important though: usually you'll first have to use al_ustr_offset(3alleg5) to find the byte offsets, because we're talking bytes here, not characters. Do not skip that step, bestie, it's giving essential 🫢

Returns true on success, false on error. Periodt.


πŸ‘‘ SEE ALSO πŸ‘‘


Allegro reference manual Β· al_ustr_assign_substr(3alleg5) β€” mwah, that's the whole page, thanks for reading my lil doc, you ate πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from