ustricmp(3alleg4)

✨ ustricmp ✨

okay bestie, so we're in the Allegro manual today (that's 3alleg4 if you're keeping track, and the page is literally called ustricmp) and this one is a little baby function that does one thing and does it slay πŸ’…


πŸŽ€ NAME πŸŽ€

ustricmp β€” compares two strings ignoring case. Allegro game programming library. that's it. that's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro.h>

int ustricmp(const char *s1, const char *s2);

yes ma'am, two const char * besties walk in, one int walks out. ✨


πŸ’– DESCRIPTION πŸ’–

so like. this function compares s1 and s2, ignoring case. that's the whole thing. "HELLO" and "hello"? same girl. they match. no cap.

example, because examples ate:

if (ustricmp(string, user_input) == 0) {
   /* string and user_input are equal (ignoring case) */
}

see how it returns 0 and that means equal? classic C behavior, lowkey iconic. πŸ‘‘


⭐ RETURN VALUE ⭐

here's the tea:

  • returns zero if the strings are equal 🫢
  • returns a positive number if s1 comes after s2 in the ASCII collating sequence
  • otherwise it returns a negative number

so like, it's not just yes/no, it's a whole vibe check with direction. iykyk. 🌈


πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, they're all in the same friend group fr fr:


not me writing a whole love letter to a case-insensitive string comparison function 😭 but she deserves it. periodt. πŸ’œ

and that's the page bestie!! brought to you by Allegro version 4.4.3 β€” mwah, stan the Allegro manual, she never misses πŸŽ€βœ¨πŸ’–