Namespaces
Variants
Views
Actions

strspn

From cppreference.com
< c‎ | string‎ | byte
Revision as of 21:16, 5 April 2013 by 60.50.240.65 (Talk)

Defined in header <string.h>
size_t strspn( const char *dest, const char *src );

Returns the length of the maximum initial segment of the byte string pointed to by dest, that consists of only the characters found in byte string pointed to by src.

Contents

Parameters

dest - pointer to the null-terminated byte string to be analyzed
src - pointer to the null-terminated byte string that contains the characters to search for

Return value

The length of the maximum initial segment that contains only characters from byte string pointed to by src

Example

char *string_find = "abcde312$#@";
char *lowal_pha = "qwertyuiopasdfghjklzxcvbnm";
printf("%i", strspn(string_find, low_alpha));

Output:

5

See also

Template:c/string/byte/dcl list strcspnTemplate:c/string/byte/dcl list strpbrk