- The Modern C++ Challenge
- Marius Bancila
- 73字
- 2021-06-25 22:01:28
26. Joining strings together separated by a delimiter
Write a function that, given a list of strings and a delimiter, creates a new string by concatenating all the input strings separated with the specified delimiter. The delimiter must not appear after the last string, and when no input string is provided, the function must return an empty string.
Example: input { "this","is","an","example" } and delimiter ' ' (space), output: "this is an example".