How to split in cpp | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to split in cpp

How can i split an string in to an array/vector

9th Aug 2020, 4:23 PM
sid
sid - avatar
3 Answers
9th Aug 2020, 4:38 PM
Jayakrishna 🇮🇳
+ 1
https://code.sololearn.com/clAS6jyKT3fu/?ref=app sid there are 2 variants 1 variant is old c++ style, the second one is c++11 variant, using foreach and lambda function. i use rbegin and rend for test. but in fact need use begin and end function
9th Aug 2020, 7:13 PM
george
george - avatar
+ 1
convert std::string to std::vector<char> using std::copy: https://code.sololearn.com/cRR56Zv01TB6/#cpp split words with std::istringstream: https://code.sololearn.com/cpGQp3IuJ5ll/#cpp
9th Aug 2020, 8:37 PM
Ockert van Schalkwyk
Ockert van Schalkwyk - avatar