Answers for "split string on empty space in c++"

C++
1

string split by space c++

// Extract the first token
char * token = strtok(string, " ");
// loop through the string to extract all other tokens
while( token != NULL ) {
  printf( " %sn", token ); //printing each token
  token = strtok(NULL, " ");
}
return 0;
Posted by: Guest on April-21-2021

Browse Popular Code Answers by Language