60 if (ending.empty() || empty() || back() ==
'/')
64 else if (ending[0] ==
'.')
66 if (ending.size() == 1)
83 if (ending.empty() || ending.isLiteral())
85 return has_ext(static_cast<const std::string&>(ending));
88 const auto i = find_ext();
95 return ending.match(substr(i+1));
109 const std::string& s1,
110 const std::string& s2,
116 std::string::replace(
pos, s1.size(), s2);
125 const std::string& s1,
126 const std::string& s2,
130 const auto n1 = s1.length();
131 const auto n2 = s2.length();
137 std::string::replace(
pos, n1, s2);
148 const std::string& s1,
155 while ((
pos = find_first_of(s1,
pos)) != npos)
159 operator[](
pos) =
c2;
182 bool changed =
false;
184 if (character &&
find(character) != npos)
187 iterator outIter =
begin();
191 for (
auto iter =
cbegin(); iter !=
cend(); ++iter)
193 const char c = *iter;
195 if (prev ==
c &&
c == character)
216 const auto txtLen = text.length();
217 const auto strLen = length();
219 if (txtLen && strLen >= txtLen && !compare(0, txtLen, text))
231 const auto txtLen = text.length();
232 const auto strLen = length();
234 if (txtLen && strLen >= txtLen && !compare(strLen - txtLen, npos, text))
236 erase(strLen - txtLen);
246 if (length() > 1 && front() ==
c)
258 const auto n = length();
259 if (
n > 1 && back() ==
c)
string & replace(const std::string &s1, const std::string &s2, size_type pos=0)
Replace first occurrence of sub-string s1 with s2, beginning at pos.
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Same as ListOps::find_if.
std::string::size_type find_ext() const
Find position of a file extension dot, return npos on failure.
int debugSwitch(const char *name, const int deflt=0)
Lookup debug switch or add default value.
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
static const char *const typeName
The type name "string".
dimensionedScalar pos(const dimensionedScalar &ds)
bool has_ext() const
Return true if it has an extension or simply ends with a '.'.
static int debug
The debug flag.
A class for handling words, derived from Foam::string.
word ext() const
Return file name extension (part after last .)
string & replaceAny(const std::string &s1, const char c2, size_type pos=0)
Replace any occurrence of s1 characters with c2, beginning at pos in the string.
constexpr auto cend(const C &c) -> decltype(c.end())
Return const_iterator to the end of the container c.
graph_traits< Graph >::vertices_size_type size_type
bool removeRepeated(const char character)
Remove repeated characters.
static const string null
An empty string.
void inplaceExpand(std::string &s, const HashTable< string > &mapping, const char sigil='$')
Inplace expand occurrences of variables according to the mapping. Does not use environment values...
constexpr auto cbegin(const C &c) -> decltype(c.begin())
Return const_iterator to the beginning of the container c.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
string & replaceAll(const std::string &s1, const std::string &s2, size_type pos=0)
Replace all occurrences of sub-string s1 with s2, beginning at pos in the string. ...
size_type count(const char c) const
Count the number of occurrences of the specified character in the string.
string & expand(const bool allowEmpty=false)
Inplace expand initial tags, tildes, and all occurrences of environment variables as per stringOps::e...
const dimensionedScalar c
Speed of light in a vacuum.
std::string::size_type count(const std::string &s, const char c)
Count the number of occurrences of the specified character.
bool removeStart(const std::string &text)
Remove the given text from the start of the string.
constexpr auto begin(C &c) -> decltype(c.begin())
Return iterator to the beginning of the container c.
A class for handling character strings derived from std::string.
bool removeEnd(const std::string &text)
Remove the given text from the end of the string.