function
<cstring>
strspnsize_t strspn ( const char * str1, const char * str2 );
Get span of character set in string
Returns the length of the initial portion of str1 which consists only of characters that are part of str2.The search does not include the terminating null-characters of either strings, but ends there.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* strspn example */
#include <stdio.h>
#include <string.h>
int main ()
{
int i;
char strtext[] = "129th";
char cset[] = "1234567890";
i = strspn (strtext,cset);
printf ("The initial number has %d digits.\n",i);
return 0;
}
The initial number has 3 digits.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4