mario::konrad
programming / C++ / sailing / nerd stuff
C++ String Join
© 2005 / Mario Konrad

Concatenates all elements from a series (defined by iterators) to a list, represented by a string.

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include "string_join.hpp"
#include <vector>
#include <iostream>

int main(int argc, char ** argv)
{
    std::vector<std::string> v;
    v.reserve(argc);
    for (int i = 0; i < argc; ++i)
        v.push_back(argv[i]);

    std::cout << utils::join(v.begin(), v.end()) << std::endl;
    return 0;
}