fixed str_split
This commit is contained in:
parent
5f77a905fa
commit
618d178724
@ -79,10 +79,10 @@ str_split(char const * s, char c)
|
||||
for (i = 1; s[i]; ++i)
|
||||
{
|
||||
|
||||
if (s[i] == c && s[i - 1] != c)
|
||||
if ((s[i + 1] == c || !s[i + 1]) && s[i] != c)
|
||||
{
|
||||
/* end of a token*/
|
||||
ret[current_token_i] = strndup(s + token_start_i, i - token_start_i);
|
||||
ret[current_token_i] = strndup(s + token_start_i, i - token_start_i + 1);
|
||||
if (!ret[current_token_i])
|
||||
{
|
||||
split_clean(ret);
|
||||
|
Reference in New Issue
Block a user