I have a std::string
that contains a random phrase.
For example:
std::string str{ "Lorem ipsum" };
I'd like to take that string and convert it into a std::vector<std::vector<char>>
(each sub-array would have all the characters for one word in the phrase, i.e. splitting on spaces).
For example after the conversion:
std::vector<std::vector<char>> arr{ { 'L', 'o', 'r', 'e', 'm' }, { 'i', 'p', 's', 'u', 'm' } };
Furthermore, I'd like to then be able to convert the std::vector<std::vector<char>>
back into a std::string
.
Thank you for the help!