ustrnicmp(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– ustrnicmp(3) πŸ’–

okay bestie, welcome to the Allegro manual β€” this is ustrnicmp, and she compares up to n letters of two strings while straight-up ignoring case. yes, ignoring. like she did not see that capital letter, it's not her problem. 🌸 part of the Allegro game programming library, obviously. πŸ’…


✨ SYNOPSIS ✨

#include <allegro.h>

int ustrnicmp(const char *s1, const char *s2, int n);

like, that's it. that's the whole vibe. 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so what she does is: she compares up to n characters of s1 and s2, and she does it ignoring case. so 'A' and 'a'? same girl. besties. no drama. πŸ‘‘

here's the moment everyone screenshots, fr fr:

if (ustrnicmp(prefix, long_string, ustrlen(prefix)) == 0) {
   /* long_string starts with prefix (ignoring case) */
}

see what she did there?? iconic. prefix-checking behaviour. main character energy. ✨


πŸŽ€ RETURN VALUE πŸŽ€

okay so the numbers, no cap:

  • zero β€” the strings are equal, slay πŸ’–
  • a positive number β€” s1 comes after s2 in the ASCII collating sequence
  • otherwise a negative number β€” because s1 comes before s2

so it's giving classic compare energy, just with the case-blindness turned all the way up. πŸ’…


🌈 SEE ALSO 🌈

go read those too bestie, they're all in the same friend group 🧚


ngl the whole thing is from the Allegro manual, version 4.4.3 β€” so yeah, that's the version, that's the source, that's the era. periodt. πŸ’œ πŸ¦‹ ⭐ πŸ“
πŸ“¦ where this page comes from