标签:des ar sp on art amp 时间 as c
描述:输入一个字符串("abc$rr$asdsakk$"),和一个分隔符("$"),进行字符串分割,反正就是实现split(题目好像就是这样,时间太久记得不太清楚了)。
void _c_split(const char* _src, const char* _delimiter, char** _dest)
{
assert( _src!=NULL && _delimiter!=NULL && _dest!=NULL );
int srcLen = strlen(_src), deLen = strlen(_delimiter);
if ( srcLen==0 || deLen==0 )
return;
char* start = _src, *end;
while ( ture )
{
end = strstr(start,_delimiter);
if ( end!=NULL )
{
memset(end, ‘\0‘ , deLen);
*_dest++ = start;
end = end+deLen;
start = end;
}
else
{
*_dest = start;
break;
}
}
}
标签:des ar sp on art amp 时间 as c
原文地址:http://www.cnblogs.com/geekpaul/p/4109148.html