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. NULL is not permitted! 🚫
  • str2 β€” the second string to compare. NULL is not permitted! 🚫

✨ RETURN VALUE ✨

  • returns less than zero if str1 is "less than" str2
  • returns greater than zero if str1 is "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