This shows you the differences between two versions of the page.
c:string.h:strspn [2012/07/16 22:41] 127.0.0.1 external edit |
c:string.h:strspn [2024/02/16 01:06] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | size_t strspn(const char *str1, const char *str2); | + | {{keywords>wiki library source code example reference}} |
+ | ====== strspn ====== | ||
+ | |||
+ | <code c> | ||
+ | #include <stdlib.h> | ||
+ | size_t strspn(const char *str1, const char *str2); | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== strspn C Sourcecode Example ===== | ||
+ | <code c> | ||
+ | /* | ||
+ | * strspn example code | ||
+ | * http://code-reference.com/c/string.h/strspn | ||
+ | */ | ||
+ | #include <stdio.h> | ||
+ | #include <string.h> | ||
+ | |||
+ | int main( void ) | ||
+ | { | ||
+ | const char string[] = "the answer is 42"; | ||
+ | int pos = strspn(string, "the answer = 42"); | ||
+ | printf("different char at position :%d\n",pos+1); | ||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | </code> | ||
+ | |||
+ | ==== output of strspn c example ==== | ||
+ | different char at position :12 |