Add conversion methods: multiline str <=> array of lines
This commit is contained in:
parent
d25265fee1
commit
a0c6868e88
|
@ -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…
Reference in New Issue