strok的实现,分割字符串

strok的实现,分割字符串

  
    
char * xl_strtok( char * s, const char * dm)
{
static char * last;
char * tok;
if (s == NULL)
s
= last;
if (s == NULL)
return NULL;
tok
= s;
while ( * s != ' \0 ' )
   {
while ( * dm)
      {
if ( * s == * dm)
       {
* s = ' \0 ' ;
last
= s + 1 ;
break ;
}
s
++ ;
}
}
return tok;
}

你可能感兴趣的:(字符串)