R
RaulGonz
char *token = strtok(str,",");
int i = 0;
while(token != NULL)
{
switch(i)
(str = abc,cde,0.5,,hi,0)
in this case, case0 = abc, case1 = cde, case2 = 0.5, case3 = hi and
case4 = 0. however, it is missing the fourth "data" in this case. i
want to display case0 = abc, case1 = cde, case2 = 0.5, case3 = NA,
case4 = hi and case5 = 0.
the problem here is that once the code sees the first comma, it is
preparing to break down the string but however, it faces yet another
comma immediately, so the "data" between the consecutive commas is
ignored. is there any way that i can overcome this by displaying "NA"
whenever two consecutive commas appears because it could be from
element 1 to 6 that is missing or not available in the string.
please advise. thank you!
int i = 0;
while(token != NULL)
{
switch(i)
(str = abc,cde,0.5,,hi,0)
in this case, case0 = abc, case1 = cde, case2 = 0.5, case3 = hi and
case4 = 0. however, it is missing the fourth "data" in this case. i
want to display case0 = abc, case1 = cde, case2 = 0.5, case3 = NA,
case4 = hi and case5 = 0.
the problem here is that once the code sees the first comma, it is
preparing to break down the string but however, it faces yet another
comma immediately, so the "data" between the consecutive commas is
ignored. is there any way that i can overcome this by displaying "NA"
whenever two consecutive commas appears because it could be from
element 1 to 6 that is missing or not available in the string.
please advise. thank you!