Indentation fix, cleanup.
[AROS.git] / compiler / stdc / strspn.c
blobabe3846750accb676bf57f285fcab8c528cc007a
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function strspn().
6 */
8 /*****************************************************************************
10 NAME */
11 #include <string.h>
13 size_t strspn (
15 /* SYNOPSIS */
16 const char * str,
17 const char * accept)
19 /* FUNCTION
20 Calculates the length of the initial segment of str which consists
21 entirely of characters in accept.
23 INPUTS
24 str - The string to check.
25 accept - Characters which have to be in str.
27 RESULT
28 Length of the initial segment of str which contains only
29 characters from accept.
31 NOTES
33 EXAMPLE
34 char buffer[64];
36 strcpy (buffer, "Hello ");
38 // Returns 5
39 strspn (buffer, "Helo");
41 // Returns 0
42 strspn (buffer, "xyz");
44 BUGS
46 SEE ALSO
48 INTERNALS
50 ******************************************************************************/
52 size_t n = 0;
54 while (*str && strchr (accept, *str))
56 str ++;
57 n ++;
60 return n;
61 } /* strspn */