1 /******************************************************************************* 2 * tlx/string/split_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_SPLIT_QUOTED_HEADER 12 #define TLX_STRING_SPLIT_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 * Split the given string at each separator character into distinct 26 * substrings. Multiple separators are joined and will not result in empty split 27 * substrings. Quoted fields extend to the next quote. Quoted fields may 28 * containg escaped quote, and \\n \\r \\t \\\\ sequences. 29 */ 30 std::vector<std::string> split_quoted( 31 const std::string& str, char sep, char quote, char escape); 32 33 /*! 34 * Split the given string at each space into distinct substrings. Multiple 35 * spaces are joined and will not result in empty split substrings. Quoted 36 * fields extend to the next quote. Quoted fields may containg escaped quote, 37 * and \\n \\r \\t \\\\ sequences. 38 */ 39 std::vector<std::string> split_quoted(const std::string& str); 40 41 //! \} 42 //! \} 43 44 } // namespace tlx 45 46 #endif // !TLX_STRING_SPLIT_QUOTED_HEADER 47 48 /******************************************************************************/ 49