Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : strspn

size_tstrspn(const char * str1,const char * str2) ;

Return Type : size_t

Platform-specific unsigned type for array indices and memory sizes.
Read about return values of strspn function .

1st Parameter Type : const char *

Pointer to read-only string

1st Parameter

Pointer to the null-terminated string to be scanned.

2nd Parameter Type : const char *

Pointer to read-only string

2nd Parameter

Pointer to the null-terminated string containing the set of characters to match in `str1`.

Read more about parameters of strspn in parameters section
The strspnfunction in C language Calculates the length of the initial segment of the string which consists only of characters found in a specified string.
The strspn function calculates the length of the initial segment of str1 which consists entirely of characters in str2. In other words, it returns the index of the first character in str1 that does not appear in str2.
The strspnfunction takes 2 parameters:
  • const char * `str1`: Pointer to the null-terminated string to be scanned.
  • const char * `str2`: Pointer to the null-terminated string containing the set of characters to match in `str1`.
Calculates the length of the initial segment of `str1` consisting entirely of characters found in `str2`. Returns the number of characters in this segment as a `size_t`.
The strspn function return value :
  • Returns the number of characters in the initial segment of str1 which consist only of characters from str2

Output

This example demonstrates basic usage of strspn to find the length of the initial segment of digits in a string.