提交 781fd25b 编写于 作者: B bernard.xiong

add strcspn implementation.

git-svn-id: https://rt-thread.googlecode.com/svn/trunk@533 bbd45198-f89e-11dd-88c7-29a3b14d5316
上级 bc013f8a
......@@ -564,6 +564,21 @@ size_t strspn(const char *s, const char *accept)
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*tmp=0;
......
......@@ -70,6 +70,9 @@ char *strdup(const char *s);
char *strtok(char *s, const char *delim);
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册