strspn()
and strcspn()
for String Span Operationsstrspn()
and strcspn()
for String Span OperationsThe strspn()
function finds the length of the initial segment of a string that consists entirely of characters contained in a given mask. Conversely, strcspn()
finds the length of the initial segment that does not contain any of the characters in a given mask. These functions are useful for parsing and validating strings.