aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/other/strdiff.c
blob: a0297f6c70c1567a5dd5c2d3bed87dd44202f7d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* 
 * Often used to evaluate similarity of soundex codes.
 * $Id$
 * Copyright (c) 1997 by Tycho Softworks.
 * For conditions of distribution and reuse see product license.
 */

#include <other/string.h>
#include <std/math.h>

int     strdiff(const char *s1, const char *s2)
{
        int     l1 = len(s1);
        int     l2 = len(s2);
        int     l = min(l1, l2);
        int     dif = abs(l1 - l2);

        while(l--)
        {
                if(*(s1++) != *(s2++))
                        ++dif;
        }
        return dif;
}