Parameters
- str1
- C string to be scanned.
- str2
- C string containing the characters to match.
Return value
The length of the initial portion of str1 containing only characters that appear in str2.Therefore, if all of the characters in str1 are in str2, the function returns the length of the entire str1 string, and if the first character in str1 is not in str2, the function returns zero.
Example
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Output:
The length of initial number is 3. |
See also
| strcspn | Get span until character in string (function) |
| strstr | Locate substring (function) |
| strncmp | Compare characters of two strings (function) |
