tlx
Loading...
Searching...
No Matches
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 <tb@panthema.net>
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
17namespace 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 */
29std::string join_quoted(
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 */
37std::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