#include <boost/algorithm/string/join.hpp>
#include <vector>
#include <iostream>
int main()
{
std::vector<std::string> list;
list.push_back("Hello");
list.push_back("World!");
std::string joined = boost::algorithm::join(list, ", ");
std::cout << joined << std::endl;
}
Output:
Hello, World!
std::vector<std::string> MyStrings;
MyStrings.push_back("Hello");
MyStrings.push_back("World");
std::string result = boost::algorithm::join(MyStrings, ",");
std::cout << result; // prints "Hello,World"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With