Go to the documentation of this file.
60 if (ending.empty() || empty() || back() ==
'/')
64 else if (ending[0] ==
'.')
66 if (ending.size() == 1)
93 ((size() - i) == ending.size())
94 && !compare(i, npos, ending)
101 const auto i = find_ext();
107 const std::string
end = substr(i+1);
122 const std::string& s1,
123 const std::string& s2,
129 std::string::replace(
pos, s1.size(), s2);
138 const std::string& s1,
139 const std::string& s2,
143 const auto n1 = s1.length();
144 const auto n2 = s2.length();
150 std::string::replace(
pos, n1, s2);
168 bool changed =
false;
170 if (character &&
find(character) != npos)
173 iterator outIter =
begin();
177 for (
auto iter =
cbegin(); iter !=
cend(); ++iter)
179 const char c = *iter;
181 if (prev ==
c &&
c == character)
202 const auto txtLen = text.length();
203 const auto strLen = length();
205 if (txtLen && strLen >= txtLen && !compare(0, txtLen, text))
217 const auto txtLen = text.length();
218 const auto strLen = length();
220 if (txtLen && strLen >= txtLen && !compare(strLen - txtLen, npos, text))
232 if (length() > 1 && front() ==
c)
244 const auto n = length();
245 if (
n > 1 && back() ==
c)
string & replace(const std::string &s1, const std::string &s2, size_type pos=0)
std::string::size_type find_ext() const
Find position of a file extension dot, return npos on failure.
bool hasExt() const
Return true if it has an extension or simply ends with a '.'.
A class for handling words, derived from Foam::string.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
A class for handling character strings derived from std::string.
static const char *const typeName
The type name "string".
A wordRe is a Foam::word, but can contain a regular expression for matching words or strings.
static int debug
The debug flag.
std::string::size_type count(const std::string &str, const char c)
Count the number of occurrences of the specified character.
patchWriters resize(patchIds.size())
word ext() const
Return file name extension (part after last .)
void inplaceExpand(std::string &s, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
graph_traits< Graph >::vertices_size_type size_type
bool removeRepeated(const char character)
Remove repeated characters.
static const string null
An empty string.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
string & replaceAll(const std::string &s1, const std::string &s2, size_type pos=0)
constexpr auto cend(const C &c) -> decltype(c.end())
Return const_iterator to the end of the container c.
constexpr auto cbegin(const C &c) -> decltype(c.begin())
Return const_iterator to the beginning of the container c.
size_type count(const char c) const
string & expand(const bool allowEmpty=false)
static const word null
An empty word.
const dimensionedScalar c
Speed of light in a vacuum.
bool removeStart(const std::string &text)
Remove the given text from the start of the string.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
bool removeEnd(const std::string &text)
Remove the given text from the end of the string.
bool match(const std::string &text, bool literal=false) const
Smart match as regular expression or as a string.
dimensionedScalar pos(const dimensionedScalar &ds)