C++ : split strings into tokens using strtok

preview_player
Показать описание
In this video i show you how to use strtok from c string library.
I use strtok to parse a char array string and separate it using a period as a delimiter (token)

Рекомендации по теме
Комментарии
Автор

Bro you saved my life me and my bro's. Man youzz the realest MVP my niggah.

phahladiramoja
Автор

how does writing NULL in strtok=(NULL, "."); makes the pointer moves forward from where we left off?

neerajjoshi
Автор

Question: who would I be able to count the number of tokens that it splits?

cosmopix
Автор

could this do the same with using a vector instead of an array?

MissGamesKuma
Автор

string * p = strtok("01/01/2015", "/");

it doesn't work, so it only work on char * ?

babythedude
Автор

Is there then a way to reverse the tokens?

Igthife
Автор

why it doesn't work with a string, and only with a char array ?

DoubleCoolOp
Автор

Everyday didn't have a . after it, how it appeared ?

renashmma
Автор

Can someone explain why there is a char when everywhere people write string in the title?

deividasjanuskevicius
Автор

when i follow this code, i have an error(Severity Code Description Project File Line Suppression State
Error C4996 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. ConsoleApplication20 c:\users\jk\documents\visual studio 13 )
what should i have to do. I tried to fix this problem, but it does not work. Anybody can help me?

kyungsikjeung
Автор

Great video. Can you make the same video using forms ?

deividaskiznis
Автор

anyone still having trouble, i have posted an example of how to use strtok on my channel! Check it out

maniengineering
Автор

Can anyone explain to me what the below for loop does and how it works please?
void tokenize(char *line, char **words, int *nwords)
{
*nwords=1;
for(words[0]=strtok(line, " \t\n");
(*nwords<MAX_WORDS)&&(words[*nwords]=strtok(NULL, " \t\n"));
*nwords=*nwords+1
); /* empty body */
return;
}

iamthejustin
Автор

please make a video on c programming where input will be like input=x3y7
and output will be like

avishekkumar
Автор

Teaching c in c++ is not a good thing....

humanbeing