29.01.2010, 06:04
Hello,
I want to split strings with strtok, not at a space, but on a random character, lets say ",".
Works perfectly fine but it still splits strings at spaces too. How can I fix that?
I want to split strings with strtok, not at a space, but on a random character, lets say ",".
Код:
new_strtok(const string[], &index){
new length = strlen(string);
while ((index < length) && (string[index] <= ','))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ',') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}

