SDL_strcasecmp(3)

πŸ’– SDL_strcasecmp πŸ’–

okay bestie, welcome to the SDL_strcasecmp(3) page, straight outta the SDL3 FUNCTIONS manual, no cap ✨


🌸 NAME 🌸

SDL_strcasecmp β€” compare two null-terminated UTF-8 strings, case-insensitively. yeah, case does NOT matter here, we're all equals πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_stdinc.h>

int SDL_strcasecmp(const char *str1, const char *str2);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, this one actually works with Unicode strings, using a technique called "case-folding" to handle the vast majority of case-sensitive human languages regardless of system locale. periodt. it doesn't care what your locale is set to, it just knows. main character energy fr fr 🌈

and the way that it can deal with expanding values?? iconic. a German Eszett character can compare against two ASCII 's' chars and be considered a match, for example. ate. πŸ‘‘

but ngl, there's a notable exception: it does not handle the Turkish 'i' character. human language is complicated, bestie, we can't fix everything 😭

since this handles Unicode, it expects the string to be well-formed UTF-8 and not a null-terminated string of arbitrary bytes. so heads up: bytes that are not valid UTF-8 are 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. wild, i know πŸ’€


πŸŽ€ 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. go off, queen, call it everywhere 🌈✨


🌟 AVAILABILITY 🌟

this function is available since SDL 3.2.0. so if you're on the old stuff… upgrade bestie πŸ’…


Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_strcasecmp(3) β€” mwah, that's the whole page, ily, go compare some strings case-insensitively πŸŽ€πŸ¦‹πŸ’–

πŸ“¦ where this page comes from