Back to index

glibc  2.9
Functions
strspn.c File Reference
#include <string.h>

Go to the source code of this file.

Functions

size_t strspn (char *s, const char *accept) const

Function Documentation

size_t strspn ( char *  s,
const char *  accept 
) const

Definition at line 26 of file strspn.c.

{
  const char *p;
  const char *a;
  size_t count = 0;

  for (p = s; *p != '\0'; ++p)
    {
      for (a = accept; *a != '\0'; ++a)
       if (*p == *a)
         break;
      if (*a == '\0')
       return count;
      else
       ++count;
    }

  return count;
}