Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8622 Boppan 1
/* strspn( const char *, const char * )
2
 
3
   This file is part of the Public Domain C Library (PDCLib).
4
   Permission is granted to use, modify, and / or redistribute at will.
5
*/
6
 
7
#include 
8
 
9
size_t strspn( const char * s1, const char * s2 )
10
{
11
    size_t len = 0;
12
    const char * p;
13
 
14
    while ( s1[ len ] )
15
    {
16
        p = s2;
17
 
18
        while ( *p )
19
        {
20
            if ( s1[len] == *p )
21
            {
22
                break;
23
            }
24
 
25
            ++p;
26
        }
27
 
28
        if ( ! *p )
29
        {
30
            return len;
31
        }
32
 
33
        ++len;
34
    }
35
 
36
    return len;
37
}