flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY
string_utils.cpp
Go to the documentation of this file.
1// ====================================================================
2// This file is part of FlexibleSUSY.
3//
4// FlexibleSUSY is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published
6// by the Free Software Foundation, either version 3 of the License,
7// or (at your option) any later version.
8//
9// FlexibleSUSY is distributed in the hope that it will be useful, but
10// WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with FlexibleSUSY. If not, see
16// <http://www.gnu.org/licenses/>.
17// ====================================================================
18
19#include "string_utils.hpp"
20
21namespace flexiblesusy {
22
23std::string concat(const std::vector<std::string>& strings)
24{
25 std::string result;
26
27 for (const auto& s: strings)
28 result += s;
29
30 return result;
31}
32
33
34std::string concat(const std::vector<std::string>& strings, const std::string& separator)
35{
36 std::string result;
37
38 for (auto it = strings.cbegin(), end = strings.end(); it != end; ++it) {
39 if (it != strings.cbegin()) {
40 result += separator;
41 }
42 result += *it;
43 }
44
45 return result;
46}
47
48
49std::string concat(const std::vector<std::string>& strings, char separator)
50{
51 return concat(strings, std::string(1, separator));
52}
53
54} // namespace flexiblesusy
double * end(GSL_vector &v)
iterator to end of GSL_vector
Definition: gsl_vector.cpp:254
std::string concat(const std::vector< std::string > &strings)
concatenate strings