al_ustr_assign_substr(3)
π al_ustr_assign_substr(3) π
okay bestie, welcome to the Allegro 5 API β this one lives in the Library Functions Manual, and it's genuinely one of the cutest little string functions out there, no cap β¨
πΈ NAME πΈ
al_ustr_assign_substr β Allegro 5 API π«Ά
β¨ SYNOPSIS β¨
#include <allegro5/allegro.h>
bool al_ustr_assign_substr(ALLEGRO_USTR *us1, const ALLEGRO_USTR *us2,
int start_pos, int end_pos)
like, that's the whole vibe check right there π
π¦ DESCRIPTION π¦
so here's the tea π: this function overwrites the string us1 with the contents of us2 β but only the slice of us2 in the byte interval [start_pos, end_pos). it's giving "cut and paste but make it bytes" π
note the interval, bestie: start_pos is included, end_pos is not β classic half-open situation, iykyk π₯
and the end points? they get clamped to the bounds of us2 β so if you go a little feral with your numbers, it just politely clamps instead of exploding π (still, maybe don't test fate)
usually you'll first have to use al_ustr_offset(3) to find the byte offsets β that's your little map to the territory, fr fr π§
returns true on success, false on error π
π SEE ALSO π
lowkey the whole point: slice + overwrite + clamp. periodt π
okay that's the whole page bestie, you ate that reading session π this was the Allegro reference manual, al_ustr_assign_substr(3), mwah π
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms