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);
161 const std::string& s1,
168 while ((
pos = find_first_of(s1,
pos)) != npos)
172 operator[](
pos) =
c2;
195 bool changed =
false;
197 if (character &&
find(character) != npos)
200 iterator outIter =
begin();
204 for (
auto iter =
cbegin(); iter !=
cend(); ++iter)
206 const char c = *iter;
208 if (prev ==
c &&
c == character)
229 const auto txtLen = text.length();
230 const auto strLen = length();
232 if (txtLen && strLen >= txtLen && !compare(0, txtLen, text))
244 const auto txtLen = text.length();
245 const auto strLen = length();
247 if (txtLen && strLen >= txtLen && !compare(strLen - txtLen, npos, text))
249 erase(strLen - txtLen);
259 if (length() > 1 && front() ==
c)
271 const auto n = length();
272 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.
rAUs append(new volScalarField(IOobject::groupName("rAU", phase1.name()), 1.0/(U1Eqn.A()+byDt(max(phase1.residualAlpha() - alpha1, scalar(0)) *rho1))))
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.
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
string & replaceAny(const std::string &s1, const char c2, size_type pos=0)
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)
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
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.
std::string::size_type count(const std::string &s, const char c)
Count the number of occurrences of the specified character.
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)