al_ustr_replace_range(3alleg5)

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

πŸ’– al_ustr_replace_range β€” Allegro 5 API πŸ’–

okay bestie so you're in the al_ustr_replace_range(3alleg5) zone, part of the Allegro reference manual β€” yes, that Allegro, the Allegro 5 API, we love her, she's iconic πŸŽ€


✨ NAME ✨

al_ustr_replace_range β€” Allegro 5 API


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

bool al_ustr_replace_range(ALLEGRO_USTR *us1, int start_pos1, int end_pos1,
   const ALLEGRO_USTR *us2)

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, you take us1 and you surgically swap out the part of it that lives in the byte interval [start_pos1, end_pos1) β€” like, that little slice right there β€” and you replace it with whatever's chillin' inside us2. out with the old, in with the new, periodt πŸ’…

one tiny rule though: start_pos1 cannot be less than 0. that's a no, non-negotiable, she simply will not go negative πŸ™…

and here's the fun part β€” if start_pos1 is past the end of us1, the gap between the end of the string and start_pos1 gets padded out with NUL ('\0') bytes. yes, she'll just fill the void with NULs like it's nothing 🫢

need to figure out where those byte offsets actually are? use al_ustr_offset(3alleg5) β€” she's the map, you're the main character navigating the string πŸ—ΊοΈβœ¨

Returns true on success, false on error. that's it, that's the vibe check πŸ”₯


πŸ’œ SEE ALSO πŸ’œ


okay that's the whole page, you're literally so good at this now 🌈 anyway this lil' baddie lives in the Allegro reference manual, and the page is al_ustr_replace_range(3alleg5) β€” go forth and replace ranges, bestie, i'm obsessed πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from