Go to the documentation of this file.
30 template<
class StringType>
33 const StringType& str,
39 if (str.empty() || !delim)
47 while ((
end = str.find(delim, beg)) != std::string::npos)
49 if (keepEmpty || (beg <
end))
51 lst.
append(str.cbegin() + beg, str.cbegin() +
end);
57 if (keepEmpty ? (beg == str.size()) : (beg < str.size()))
59 lst.
append(str.cbegin() + beg, str.cend());
66 template<
class StringType>
69 const StringType& str,
70 const std::string& delim,
75 if (str.empty() || delim.empty())
83 while ((
end = str.find(delim, beg)) != std::string::npos)
85 if (keepEmpty || (beg <
end))
87 lst.
append(str.cbegin() + beg, str.cbegin() +
end);
89 beg =
end + delim.size();
93 if (keepEmpty ? (beg == str.size()) : (beg < str.size()))
95 lst.
append(str.cbegin() + beg, str.cend());
102 template<
class StringType>
105 const StringType& str,
106 const std::string& delim
110 if (str.empty() || delim.empty())
120 (
pos = str.find_first_not_of(delim,
pos)) != std::string::npos;
124 const auto end = str.find_first_of(delim,
pos);
126 if (
end == std::string::npos)
129 lst.
append(str.cbegin() +
pos, str.cend());
143 template<
class StringType>
146 const StringType& str,
152 if (str.empty() || !width)
157 const auto len = str.size();
158 lst.reserve(1 + (len / width));
162 const auto end = (
pos + width);
167 lst.
append(str.cbegin() +
pos, str.cend());
178 template<
class StringType>
181 const StringType& str
184 return splitAny(str,
"\t\n\v\f\r ");
Foam::SubStrings< StringType > split(const StringType &str, const char delim, const bool keepEmpty=false)
Split string into sub-strings at the delimiter character.
Foam::SubStrings< StringType > splitSpace(const StringType &str)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC)
Sub-ranges of a string with a structure similar to std::match_results, but without the underlying reg...
graph_traits< Graph >::vertices_size_type size_type
Foam::SubStrings< StringType > splitAny(const StringType &str, const std::string &delim)
Split string into sub-strings using any characters in delimiter.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
Foam::SubStrings< StringType > splitFixed(const StringType &str, const std::string::size_type width, const std::string::size_type start=0)
Split string into sub-strings using a fixed field width.
void append(const typename String::const_iterator &b, const typename String::const_iterator &e)
Append sub-string defined by begin/end iterators.
dimensionedScalar pos(const dimensionedScalar &ds)