Add conversion methods: multiline str <=> array of lines

experiment/srcref_basic_cfg
Martchus 5 years ago
parent d25265fee1
commit a0c6868e88
  1. 16
      conversion/stringconversion.h

@ -94,6 +94,14 @@ typename Container::value_type joinStrings(const Container &strings,
return res;
}
/*!
* \brief Converts the specified \a arrayOfLines to a multiline string.
*/
template <class Container = std::initializer_list<std::string>> inline std::vector<std::string> toMultiline(const Container &arrayOfLines)
{
return joinStrings(arrayOfLines, "\n", false);
}
/*!
* \brief Specifies the role of empty parts when splitting strings.
*/
@ -150,6 +158,14 @@ Container splitString(const typename Container::value_type &string, const typena
return res;
}
/*!
* \brief Converts the specified \a multilineString to an array of lines.
*/
template <class Container = std::vector<std::string>> inline std::vector<std::string> toArrayOfLines(const std::string &multilineString)
{
return splitString<Container>(multilineString, "\n", EmptyPartsTreat::Keep);
}
/*!
* \brief Returns whether \a str starts with \a phrase.
*/

Loading…
Cancel
Save