1 /* 2 * Copyright (c) 2019 Peter Bigot Consulting, LLC 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #include <string.h> 8 #include <string.h> 9 strspn(const char * s,const char * accept)10size_t strspn(const char *s, 11 const char *accept) 12 { 13 const char *ins = s; 14 15 while ((*s != '\0') && (strchr(accept, *s) != NULL)) { 16 ++s; 17 } 18 19 return s - ins; 20 } 21 strcspn(const char * s,const char * reject)22size_t strcspn(const char *s, 23 const char *reject) 24 { 25 const char *ins = s; 26 27 while ((*s != '\0') && (strchr(reject, *s) == NULL)) { 28 ++s; 29 } 30 31 return s - ins; 32 } 33