add strcspn implementation.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@533 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
bc013f8a83
commit
781fd25bc9
|
@ -564,6 +564,21 @@ size_t strspn(const char *s, const char *accept)
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t strcspn(const char *s, const char *reject)
|
||||||
|
{
|
||||||
|
size_t l=0;
|
||||||
|
int a=1,i,al=strlen(reject);
|
||||||
|
|
||||||
|
while((a)&&(*s))
|
||||||
|
{
|
||||||
|
for(i=0;(a)&&(i<al);i++)
|
||||||
|
if (*s==reject[i]) a=0;
|
||||||
|
if (a) l++;
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
char*strtok_r(char*s,const char*delim,char**ptrptr)
|
char*strtok_r(char*s,const char*delim,char**ptrptr)
|
||||||
{
|
{
|
||||||
char*tmp=0;
|
char*tmp=0;
|
||||||
|
|
|
@ -70,6 +70,9 @@ char *strdup(const char *s);
|
||||||
char *strtok(char *s, const char *delim);
|
char *strtok(char *s, const char *delim);
|
||||||
char*strtok_r(char*s, const char*delim, char**ptrptr);
|
char*strtok_r(char*s, const char*delim, char**ptrptr);
|
||||||
|
|
||||||
|
size_t strcspn(const char *s, const char *reject);
|
||||||
|
size_t strspn (const char *s, const char *accept);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue