ustrncmp(3alleg4)
β¨ ustrncmp β bestie, let's compare some strings β¨
okay so this is ustrncmp from the Allegro game programming library π and it does exactly what it says on the tin: it compares up to n letters of two strings. that's it. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
#include <allegro.h>
int ustrncmp(const char *s1, const char *s2, int n);
π DESCRIPTION π
so like, ustrncmp compares up to n characters of s1 and s2. not the whole string, just the first n of them. iconic behavior honestly. π
here's the moment everyone's been waiting for, the example:
if (ustrncmp(prefix, long_string, ustrlen(prefix)) == 0) {
/* long_string starts with prefix */
}
see what she's doing there? comparing exactly ustrlen(prefix) characters so she can check if long_string starts with prefix. queen behavior. no cap. π
β RETURN VALUE β
- returns zero if the substrings are equal π«Ά
- returns a positive number if
s1comes afters2in the ASCII collating sequence - otherwise returns a negative number
that's the whole personality. positive, negative, or zero. main character energy fr fr. π
π SEE ALSO π
uconvert(3alleg4)ustrsize(3alleg4)ustrsizez(3alleg4)ustrcmp(3alleg4)ustricmp(3alleg4)ustrnicmp(3alleg4)
go read those too bestie, they're all part of the same friend group π§β¨
okay that's the whole page!! this was brought to you by Allegro, version 4.4.3, and the letter n π stay slaying, and remember: ustrncmp only compares up to n characters, so don't come for her about the rest of the string. periodt. π
ππ¦πΈπ
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms