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

πŸ’– fstrcoll β€” NAME πŸ’–

okay so bestie, welcome to fstrcoll(3) β€” straight out of the Library Functions Manual, and she's here to do one job and do it iconically.

fstrcoll β€” fuzzy comparison of two strings using the current locale πŸ¦‹


✨ SYNOPSIS ✨

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

🌸 DESCRIPTION 🌸

so the strcoll() function compares the two strings sting1 and string2. (yes bestie, it literally says sting1 in the source β€” typo and all, we stan a legend πŸ’…).

the comparison is based on strings interpreted as appropriate for the program's current locale for category LC_CTYPE. like, she's not just eyeballing bytes, she's doing it culturally aware, main character energy fr fr.


πŸ‘‘ RETURN VALUE πŸ‘‘

fstrcoll hands you back a floating point value between 0.0 and FSTRCMP_IDENTICAL. here's the vibe check:

  • 0.0 β€” the strings are utterly unalike. not even a little. πŸ’€
  • FSTRCMP_IDENTICAL β€” the strings are identical. twin flames. periodt. πŸ‘―
  • more than FSTRCMP_THRESHOLD β€” and heads up, FSTRCMP_THRESHOLD lies somewhere between 0.0 and FSTRCMP_IDENTICAL β€” that's what most people would consider "similar". πŸ₯°

and if you get FSTRCMP_ERROR? that value is always negative, and it means a malloc(3) or mbstowcs(3) failure went down. so sorry bestie, something broke in the plumbing 😭


πŸ”₯ SEE ALSO πŸ”₯

  • fstrcmp(3) β€” fuzzy comparison of two strings
  • fstrcolli(3) β€” fuzzy comparison of two strings using the current locale
  • strcoll(3) β€” compare two strings using the current locale
  • mbstowcs(3) β€” convert a multibyte string to a wide-character string

  • 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. and those GNU Gettext comparison functions were, in turn, derived from GNU Diff 2.7. it's giving a whole family tree 🌈

  • Copyright (C) 1988-2009 Free Software Foundation

ngl the lineage here is unmatched β€” three generations of fuzzy comparison royalty just vibing in one manpage 🫢

okay bye bestie, this was fstrcoll(3) from the Library Functions Manual, living in fstrcmp version 0.7, with that copyright clocked at 2009. go compare some strings, you're gonna slay βœ¨πŸ’œ