Thrill  0.1
join_quoted.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/string/join_quoted.hpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2016-2018 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #ifndef TLX_STRING_JOIN_QUOTED_HEADER
12 #define TLX_STRING_JOIN_QUOTED_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 a vector of strings using a separator character. If any string contains
26  * the separator, quote the field. In the quoted string, escape all quotes,
27  * escapes, \\n, \\r, \\t sequences. This is the opposite of split_quoted().
28  */
30  const std::vector<std::string>& str, char sep, char quote, char escape);
31 
32 /*!
33  * Join a vector of strings using spaces as separator character. If any string
34  * contains a space, quote the field. In the quoted string, escape all quotes,
35  * escapes, \\n, \\r, \\t sequences. This is the opposite of split_quoted().
36  */
37 std::string join_quoted(const std::vector<std::string>& str);
38 
39 //! \}
40 //! \}
41 
42 } // namespace tlx
43 
44 #endif // !TLX_STRING_JOIN_QUOTED_HEADER
45 
46 /******************************************************************************/
std::string join_quoted(const std::vector< std::string > &vec, char sep, char quote, char escape)
Join a vector of strings using a separator character.
Definition: join_quoted.cpp:15
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220