* Determine the number of leading characters in s that do not match characters in a * @param s A pointer to the string to analyse * @param a A pointer to an array of characters that do not match the prefix * @return The number of not matching characters */
| 488 | * @return The number of not matching characters |
| 489 | */ |
| 490 | size_t strcspn(const char *s, const char *a) |
| 491 | { |
| 492 | size_t i; |
| 493 | size_t al = strlen(a); |
| 494 | for (i = 0; s[i] != 0; i++) { |
| 495 | int found = 0; |
| 496 | for (size_t j = 0; j < al; j++) { |
| 497 | if (s[i] == a[j]) { |
| 498 | found = 1; |
| 499 | break; |
| 500 | } |
| 501 | } |
| 502 | if (found) |
| 503 | break; |
| 504 | } |
| 505 | return i; |
| 506 | } |
| 507 | |
| 508 | /** |
| 509 | * Extract first token in string str that is delimited by a character in tokens. |