logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

strspn, strcspn - get length of a prefix substring

Attributes

       For an explanation of the terms used in this section, see attributes(7).
       ┌─────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
       │ InterfaceAttributeValue   │
       ├─────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
       │ strspn(), strcspn()                                                         │ Thread safety │ MT-Safe │
       └─────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘

Description

       The  strspn()  function  calculates  the  length  (in  bytes)  of the initial segment of s which consists
       entirely of bytes in accept.

       The strcspn() function calculates the length of the initial segment of s which consists entirely of bytes
       not in reject.

History

       POSIX.1-2001, C89, SVr4, 4.3BSD.

Library

       Standard C library (libc, -lc)

Name

       strspn, strcspn - get length of a prefix substring

Return Value

       The strspn() function returns the number of bytes in the initial segment of s which consist only of bytes
       from accept.

       The strcspn() function returns the number of bytes in the initial segment of  s  which  are  not  in  the
       string reject.

See Also

memchr(3), strchr(3), string(3), strpbrk(3), strsep(3), strstr(3), strtok(3), wcscspn(3), wcsspn(3)

Linux man-pages 6.9.1                              2024-05-02                                          strspn(3)

Standards

       C11, POSIX.1-2008.

Synopsis

#include<string.h>size_tstrspn(constchar*s,constchar*accept);size_tstrcspn(constchar*s,constchar*reject);