fstrcasecmp(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

πŸ’– fstrcasecmp β€” the fuzzy-girlie string matcher πŸ’–

okay so bestie, welcome to fstrcasecmp(3), a page from the Library Functions Manual. no cap, this one is short but it's giving extremely useful. let's get into it 🫢


✨ NAME ✨

fstrcasecmp β€” fuzzy comparison of two strings ignoring case

like, it compares two strings but it's chill about it. and it does NOT care about your capitalization. case? don't know her. πŸ’…


✨ SYNOPSIS ✨

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

so you pull in the header, you get these three little defines β€” FSTRCMP_IDENTICAL, FSTRCMP_THRESHOLD and FSTRCMP_ERROR β€” and then there's the actual function, fstrcasecmp(), taking two const char *s named string1 and string2. iconic signature honestly 🌸


✨ DESCRIPTION ✨

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

that's it. that's the whole vibe check. two strings walk in, case gets ignored, a fuzzy number walks out. ✨


✨ RETURN VALUE ✨

so what do you actually get back? a floating point value between 0.0 and FSTRCMP_IDENTICAL. let's break it down, bestie:

  • 0.0 β€” the strings are utterly unalike. not even a little bit. strangers. πŸ₯€
  • FSTRCMP_IDENTICAL β€” the strings are identical. soulmates. matching bestie bracelets. πŸ’–
  • anything more than FSTRCMP_THRESHOLD β€” and fyi, FSTRCMP_THRESHOLD lies between 0.0 and FSTRCMP_IDENTICAL β€” would be considered "similar" by most people. so like, not twins but definitely cousins. πŸ‘‘
🚨 and then there's FSTRCMP_ERROR, which is always negative, and it means a malloc(3) failure happened. so if you see a negative number come back, that's not a similarity score, that's the malloc girlies failing you. be dramatic about it, you've earned it. 😭

✨ SEE ALSO ✨

go read your sisters, they're all slaying in their own lanes:


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 πŸŽ€ fstrcmp version 0.7, copyright 2009 Peter Miller, dropped back on fstrcasecmp(3) β€” go forth and compare things fuzzily, you absolute main character. mwah πŸ’‹πŸ¦‹