Created
March 21, 2019 16:49
-
-
Save voronkovich/1ec297cd7871624f6be51c13777b719e to your computer and use it in GitHub Desktop.
Fuzzy match function in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ctype.h> | |
int fuzzy_match(const char *needle, const char *haystack) | |
{ | |
while (*needle && *haystack) { | |
if (*haystack == tolower(*needle) || *haystack == toupper(*needle)) { | |
needle++; | |
} | |
haystack++; | |
} | |
return !*needle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment