fstrcasecmpi(3)

πŸ“¦
version 0.7.D001 Β· 2 versions
  • 0.7.D001 Β· debian bookworm, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.7 Β· alpine 3.24, nixpkgs unstable
, in debian bookworm, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

fstrcasecmpi β€” fuzzy comparison of two strings ignoring case

okay so bestie, real talk: this is the vibe-check function for strings. It's from the Library Functions Manual, it's fstrcasecmpi(3), and it's about to tell you how similar two strings are when you literally do not care about upper vs lower case. slay.


πŸŽ€ SYNOPSIS πŸŽ€

#include <fstrcmp.h>
#define FSTRCMP_IDENTICAL
#define FSTRCMP_THRESHOLD
#define FSTRCMP_ERROR
int fstrcasecmpi(const char *string1, const char *string2);

yes, all four lines, no skipping, we're being thorough πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

So the fstrcmp() function compares the two strings, string1 and string2, ignoring case.

That's it. That's the whole tea. πŸ“ It looks at both strings, does NOT care about your caps lock situation, and gives you a fuzzy-similarity answer. Case? Not invited to this party. πŸ™ˆ


πŸ‘‘ RETURN VALUE πŸ‘‘

It hands you back an int, and that int lives somewhere between 0 and FSTRCMPI_IDENTICAL. Let's break down the whole spectrum, because it's giving emotional range:

  • 0 β€” the strings are utterly un-alike. like, zero shared energy. not even a little. πŸ’€
  • FSTRCMPI_IDENTICAL β€” the strings are identical. twin flames. the same. periodt. πŸ‘―β€β™€οΈ
  • more than FSTRCMPI_THRESHOLD (and that threshold sits between 0 and FSTRCMPI_IDENTICAL) β€” most people would consider these strings "similar". so like, basically the same thing with a little garnish. ✨
  • FSTRCMPI_ERROR β€” always negative, and it means a malloc(3) failure went down. 😭 the memory said no.
heads up, the constants in this section are spelled exactly like the page spells them β€” FSTRCMPI_IDENTICAL, FSTRCMPI_THRESHOLD, FSTRCMPI_ERROR. yes, with the I. iykyk. no cap, that's what's written. 🫢

🌸 SEE ALSO 🌸

go read those next bestie, they're the extended universe 🧚


fstrcmp version 0.7 Copyright (C) 2009 Peter Miller Peter Miller <pmiller@opensource.org.au>

The comparison code is derived from the fuzzy comparison functions in GNU Gettext 0.17. The GNU Gettext comparison functions were, in turn, derived from GNU Diff 2.7.

Copyright (C) 1988-2009 Free Software Foundation


and that's the whole page, bestie πŸ’– shoutout to fstrcmp version 0.7, to Peter Miller <pmiller@opensource.org.au>, and to the Free Software Foundation holding it down since 1988 all the way through 2009 β€” this manual page, fstrcasecmpi(3), said what it said and now you know it. πŸŽ€βœ¨πŸ¦‹