diff options
author | John Hawthorn <john.hawthorn@gmail.com> | 2014-07-12 15:07:22 -0700 |
---|---|---|
committer | John Hawthorn <john.hawthorn@gmail.com> | 2014-07-12 15:17:04 -0700 |
commit | afeeb5bb458042c353573c2b2f464d35123e5aad (patch) | |
tree | 5e81c336692403148e8d77c915f066191d66ae2a /match.c | |
parent | e550feae6dd230ceff8ebaab91f7e41ea333d1c7 (diff) |
Add tests and split matching into match.c
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -0,0 +1,12 @@ +#include <ctype.h> + +double match(const char *needle, const char *haystack){ + while(*needle){ + if(!*haystack) + return 0.0; + while(*haystack && tolower(*needle) == tolower(*haystack++)){ + needle++; + } + } + return 1.0; +} |