Subversion Repositories Kolibri OS

Rev

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

  1. /* strcspn( 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 <string.h>
  8.  
  9. size_t strcspn( 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.                 return len;
  23.             }
  24.         }
  25.  
  26.         ++len;
  27.     }
  28.  
  29.     return len;
  30. }