Say you have a list, array, vector, storage format doesn't matter:
std::vector<int> vec; vec.push_back(1); vec.push_back(17); vec.push_back(9);
And you want to format this list into a comma delimited string without the trailing comma, what is the best way to do this?
Example output:
1,17,9
In any language, with any list type. Post your answers here. Be sure to use code formatting for your answer, to make it easier for everyone to read.
<code language="lua"> --my code solution </code>
Recent comments
10 sec ago
2 hours 55 min ago
2 hours 55 min ago
13 hours 9 min ago
14 hours 37 min ago
14 hours 37 min ago
14 hours 37 min ago
21 hours 54 min ago
2 weeks 3 days ago
4 weeks 4 days ago