SDL_wcscasecmp(3)
π SDL_wcscasecmp π
okay bestie, so this is a page from the SDL3 FUNCTIONS manual β the one and only SDL_wcscasecmp(3) β and we're gonna make it make sense, fr fr. no cap. π«Ά
β¨ NAME β¨
SDL_wcscasecmp β compares two null-terminated wide strings, and it does it case-insensitively, meaning capitalization is not the vibe check here. π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_stdinc.h>
int SDL_wcscasecmp(const wchar_t *str1, const wchar_t *str2);
β¨ DESCRIPTION β¨
so like, this works with Unicode strings (yes, the Unicode), and it does it using a little technique called "case-folding" β which handles the vast majority of case-sensitive human languages no matter what your system locale is set to. iconic behavior honestly. π
and the way it can deal with expanding values?? a German Eszett character can compare against two ASCII 's' chars and be considered a match. slay. π
but bestie, listen β there IS one notable exception: it does not handle the Turkish 'i' character. human language is complicated! π
depending on your platform, wchar_t might be 2 bytes and expected to be UTF-16 encoded (like on Windows), or 4 bytes in UTF-32 format. and since this whole thing handles Unicode, it expects the string to be well-formed and not a null-terminated string of arbitrary bytes. π¨
characters that are not valid UTF-16 (or UTF-32) get treated as Unicode character U+FFFD (REPLACEMENT CHARACTER) β which is to say, two strings of random bits may turn out to match if they convert to the same amount of replacement characters. yeah. that's a thing that can happen. π
β¨ FUNCTION PARAMETERS β¨
str1β the first string to compare.NULLis not permitted! π«str2β the second string to compare.NULLis not permitted! π«
β¨ RETURN VALUE β¨
- returns less than zero if
str1is "less than"str2 - returns greater than zero if
str1is "greater than"str2 - returns zero if the strings match exactly π―
β¨ THREAD SAFETY β¨
it is safe to call this function from any thread. no gatekeeping, no drama, go off queen. π
β¨ AVAILABILITY β¨
this function is available since SDL 3.2.0. she's new-ish but she's here. π
k bye bestie, that's the whole page!! π this came to you from the Simple Directmedia Layer, sitting pretty at SDL 3.4.18, and the page itself is dated the same β SDL_wcscasecmp(3), forever and always. mwah! πβ¨π¦
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms