]> pd.if.org Git - pdclib/blob - functions/string/strcspn.c
dos2unix
[pdclib] / functions / string / strcspn.c
1 /* $Id$ */
2
3 /* Release $Name$ */
4
5 /* strcspn( const char *, const char * )
6
7    This file is part of the Public Domain C Library (PDCLib).
8    Permission is granted to use, modify, and / or redistribute at will.
9 */
10
11 #include <string.h>
12
13 size_t strcspn( const char * s1, const char * s2 )
14 {
15     size_t len = 0;
16     const char * p;
17     while ( s1[len] )
18     {
19         p = s2;
20         while ( *p )
21         {
22             if ( s1[len] == *p++ )
23             {
24                 return len;
25             }
26         }
27         ++len;
28     }
29     return len;
30 }