0

How to split a string by whitespaces in C++?

I want to split a string, "This is a string", in separated words by whitespaces.

6th Sep 2020, 4:22 PM
Martín Santiago
Martín Santiago - avatar
3 Réponses
+ 2
unlike java and python you can’t use split(), google the strtok() function for c and c++
6th Sep 2020, 4:29 PM
Roderick Davis
Roderick Davis - avatar
+ 1
You can compare like so If (character == ' ') Then add word to array. If you try to work out an implementation of your own i could provide some more help
6th Sep 2020, 5:01 PM
StealthyTaco
StealthyTaco - avatar