Thrill  0.1
extract_between.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * tlx/string/extract_between.hpp
3  *
4  * Part of tlx - http://panthema.net/tlx
5  *
6  * Copyright (C) 2016-2017 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the Boost Software License, Version 1.0
9  ******************************************************************************/
10 
11 #ifndef TLX_STRING_EXTRACT_BETWEEN_HEADER
12 #define TLX_STRING_EXTRACT_BETWEEN_HEADER
13 
14 #include <string>
15 
16 namespace tlx {
17 
18 //! \addtogroup tlx_string
19 //! \{
20 
21 /*!
22  * Search the string for given start and end separators and extract all
23  * characters between the both, if they are found. Otherwise return an empty
24  * string.
25  *
26  * \param str string to search in
27  * \param sep1 start boundary
28  * \param sep2 end boundary
29  */
30 std::string extract_between(const std::string& str, const char* sep1,
31  const char* sep2);
32 
33 /*!
34  * Search the string for given start and end separators and extract all
35  * characters between the both, if they are found. Otherwise return an empty
36  * string.
37  *
38  * \param str string to search in
39  * \param sep1 start boundary
40  * \param sep2 end boundary
41  */
42 std::string extract_between(const std::string& str, const char* sep1,
43  const std::string& sep2);
44 
45 /*!
46  * Search the string for given start and end separators and extract all
47  * characters between the both, if they are found. Otherwise return an empty
48  * string.
49  *
50  * \param str string to search in
51  * \param sep1 start boundary
52  * \param sep2 end boundary
53  */
54 std::string extract_between(const std::string& str, const std::string& sep1,
55  const char* sep2);
56 
57 /*!
58  * Search the string for given start and end separators and extract all
59  * characters between the both, if they are found. Otherwise return an empty
60  * string.
61  *
62  * \param str string to search in
63  * \param sep1 start boundary
64  * \param sep2 end boundary
65  */
66 std::string extract_between(const std::string& str, const std::string& sep1,
67  const std::string& sep2);
68 
69 //! \}
70 
71 } // namespace tlx
72 
73 #endif // !TLX_STRING_EXTRACT_BETWEEN_HEADER
74 
75 /******************************************************************************/
std::string extract_between(const std::string &str, const char *sep1, const char *sep2)
Search the string for given start and end separators and extract all characters between the both...
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220