tlx
join.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/string/join.hpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2007-2017 Timo Bingmann <tb@panthema.net>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #ifndef TLX_STRING_JOIN_HEADER
12 #define TLX_STRING_JOIN_HEADER
13 
14 #include <string>
15 #include <vector>
16 
17 namespace tlx {
18 
19 //! \addtogroup tlx_string
20 //! \{
21 //! \name Split and Join
22 //! \{
23 
24 /******************************************************************************/
25 // join()
26 
27 /*!
28  * Join a vector of strings by some glue character between each pair from the
29  * sequence.
30  *
31  * \param glue character for glue
32  * \param parts the vector of strings to join
33  * \return string constructed from the vector with the glue between two strings
34  */
35 std::string join(
36  char glue, const std::vector<std::string>& parts);
37 
38 /*!
39  * Join a vector of strings by some glue string between each pair from the
40  * sequence.
41  *
42  * \param glue string to glue
43  * \param parts the vector of strings to join
44  * \return string constructed from the vector with the glue between two strings
45  */
46 std::string join(
47  const char* glue, const std::vector<std::string>& parts);
48 
49 /*!
50  * Join a vector of strings by some glue string between each pair from the
51  * sequence.
52  *
53  * \param glue string to glue
54  * \param parts the vector of strings to join
55  * \return string constructed from the vector with the glue between two strings
56  */
57 std::string join(
58  const std::string& glue, const std::vector<std::string>& parts);
59 
60 //! \}
61 //! \}
62 
63 } // namespace tlx
64 
65 #endif // !TLX_STRING_JOIN_HEADER
66 
67 /******************************************************************************/
std::string join(char glue, const std::vector< std::string > &parts)
Join a vector of strings by some glue character between each pair from the sequence.
Definition: join.cpp:16