-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsimil.h
More file actions
54 lines (48 loc) · 1.56 KB
/
Copy pathsimil.h
File metadata and controls
54 lines (48 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* # `simil.h`
* A Ratcliff-Obershelp style string matcher.
*
* The Ratcliff-Obershelp algorithm was presented in Dr Dobbs' Journal in
* the article _"Pattern Matching: The Gestalt Approach"_ by John W. Ratcliff
* and David E. Metzener in July 1988.
*
*
* ### License
*
* Author: Werner Stoop
* This is free and unencumbered software released into the public domain.
* See http://unlicense.org/ for more details.
*
* ## API
*/
#ifndef SIMIL_H
#define SIMIL_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
/**
* #### `int simil (const char *a, const char *b)`
* Tests the similarity of two strings `a` and `b` using the Ratcliff-Obershelp method.
*
* The return value is a value between 0 and 100 where 0 means that
* the two strings have nothing in common, and 100 means that they're exact
* matches.
*/
int simil (const char *a, const char *b);
/**
* #### `int isimil (const char *a, const char *b)`
* Tests the case-insensitive similarity of two strings a and b using
* the Ratcliff-Obershelp method.
*
* It copies the strings internally using `strdup()`, converts the copies
* to uppercase, and compares those.
*
* The return value is a value between 0 and 100 where 0 means that
* the two strings have nothing in common, and 100 means that they're exact
* matches. It may also return zero if the calls to `strdup()` fail.
*/
int isimil (const char *a, const char *b);
#if defined(__cplusplus) || defined(c_plusplus)
} /* extern "C" */
#endif
#endif /* SIMIL_H */