![]() |
![]() |
![]() |
C++ Reference: strspn()
strspn()
Declaration
size_t strspn(const char* kcpString, const char* kcpChars);
Description
This function returns the index to the first occurrence of a character that is not in the in the null-terminated set "kcpChars" that is inside the null-terminated string "kcpString."
Example
#include <cstdio>
#include <cstring>
int main()
{
char caString[] = "XoaX.net";
char caChars[] = ".aXo";
// Find the first not of ".aXo" inside of "XoaX.net"
int iPos = strspn(caString, caChars);
printf("First not of %s found at %i\n", caChars, iPos);
printf("First not in %s is %c\n", caChars, caString[iPos]);
return 0;
}
Output:
![]() |
![]() |
![]() |
| Home | | | Reference | | | Play Games! | | | Blog | | | Forum | | | Site Map | | | Contact Us |





