strspn - Get initial length of s1 including only the characters of s2
| 172 | |
| 173 | // strspn - Get initial length of s1 including only the characters of s2 |
| 174 | size_t strspn(const char *s1, const char *s2) |
| 175 | { |
| 176 | size_t ret = 0; |
| 177 | while (*s1 && strchr(s2, *s1++)) |
| 178 | ret++; |
| 179 | return ret; |
| 180 | } |
| 181 | |
| 182 | // strspn - Get initial length of s1 excluding the characters of s2 |
| 183 | size_t strcspn(const char *s1, const char *s2) |