blob: 3ab598d9279bbdfb0fc0b68b1942c725a84f4970 [file] [log] [blame]
Oliver Smith8d9a05c2018-12-12 16:03:38 +01001/*
2 * Copyright 2018 sysmocom - s.f.m.c. GmbH
3 *
Pau Espin Pedrol21d03d32019-07-22 12:05:52 +02004 * SPDX-License-Identifier: LGPL-2.1+
5 *
Oliver Smith8d9a05c2018-12-12 16:03:38 +01006 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
Oliver Smith8d9a05c2018-12-12 16:03:38 +010015 */
16
17#include <vector>
18#include <string>
19#include <sstream>
20
21std::vector<std::string> comma_delimited_to_vector(const char* opt)
22{
23 std::string str = std::string(opt);
24 std::vector<std::string> result;
25 std::stringstream ss(str);
26
27 while( ss.good() )
28 {
29 std::string substr;
30 getline(ss, substr, ',');
31 result.push_back(substr);
32 }
33 return result;
34}