39 #ifndef Foam_stringOps_H 40 #define Foam_stringOps_H 58 template<
class T1,
class T2>
class Tuple2;
80 template<
class StringType,
class UnaryPredicate>
83 const StringType& str,
84 const UnaryPredicate& meta,
85 const char quote =
'\\' 96 const char sigil =
'$' 138 const char sigil =
'$' 210 const bool allowEmpty,
211 const bool allowSubDict =
false,
212 const char sigil =
'$' 224 const std::string&
s,
226 const char sigil =
'$' 248 const char sigil =
'$' 257 string expand(
const std::string&
s,
const bool allowEmpty =
false);
275 void inplaceExpand(std::string&
s,
const bool allowEmpty =
false);
285 template<
class StringType,
class UnaryPredicate>
288 const std::string& str,
289 const UnaryPredicate& accept,
295 std::pair<size_t, size_t>
298 const std::string&
s,
300 size_t len = std::string::npos
316 string trim(
const std::string&
s);
333 string lower(
const std::string&
s);
339 string upper(
const std::string&
s);
364 const std::string& str,
372 template<
class StringType>
376 const StringType& str,
382 const bool keepEmpty =
false 387 template<
class StringType>
391 const StringType& str,
393 const std::string& delim,
397 const bool keepEmpty =
false 403 template<
class StringType>
407 const StringType& str,
409 const std::string& delim,
416 template<
class StringType>
420 const StringType& str,
429 template<
class StringType>
433 const StringType& str,
445 const std::string& str,
451 const bool escape =
false std::string::size_type count(const char *s, const char c)
Count the number of occurrences of the specified character.
Foam::SubStrings< StringType > split(const StringType &str, const char delim, std::string::size_type pos=0, const bool keepEmpty=false)
Split string into sub-strings at the delimiter character.
void inplaceUpper(std::string &s)
Inplace transform string with std::toupper on each character.
Generic output stream using a standard (STL) stream.
label splitFunctionArgs(const std::string &str, wordRes &args, List< Tuple2< word, string >> &namedArgs)
Split out arguments (named or unnamed) from an input string.
Ostream & indent(Ostream &os)
Indent stream.
string trimLeft(const std::string &s)
Return string trimmed of leading whitespace.
Specialized string sorting.
bool inplaceReplaceVar(std::string &s, const word &varName)
Replace environment variable contents with its name.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
A 2-tuple for storing two objects of dissimilar types. The container is similar in purpose to std::pa...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Foam::SubStrings< StringType > splitFixed(const StringType &str, const std::string::size_type width, std::string::size_type pos=0)
Split string into sub-strings using a fixed field width.
std::pair< size_t, size_t > findTrim(const std::string &s, size_t pos=0, size_t len=std::string::npos)
Find (first, last) non-space locations in string or sub-string.
void inplaceRemoveSpace(std::string &s)
Eliminate whitespace inplace.
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
Sub-ranges of a string with a structure similar to std::match_results, but without the underlying reg...
bool match(const UList< wordRe > &selectors, const std::string &text)
True if text matches one of the selector expressions.
Foam::SubStrings< StringType > splitAny(const StringType &str, const std::string &delim, std::string::size_type pos=0)
Split string into sub-strings using any characters in delimiter.
StringType quotemeta(const StringType &str, const UnaryPredicate &meta, const char quote='\\')
Quote any meta-characters in given string.
StringType validate(const std::string &str, const UnaryPredicate &accept, const bool invert=false)
Return a copy of the input string with validated characters.
dimensionedScalar pos(const dimensionedScalar &ds)
void inplaceTrimRight(std::string &s)
Trim trailing whitespace inplace.
A class for handling words, derived from Foam::string.
string trimRight(const std::string &s)
Return string trimmed of trailing whitespace.
void inplaceTrimLeft(std::string &s)
Trim leading whitespace inplace.
A List of wordRe with additional matching capabilities.
string trim(const std::string &s)
Return string trimmed of leading and trailing whitespace.
A HashTable similar to std::unordered_map.
graph_traits< Graph >::vertices_size_type size_type
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void inplaceRemoveComments(std::string &s)
Remove C/C++ comments inplace.
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...
OBJstream os(runTime.globalPath()/outputName)
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
static bool match(const UList< wordRe > &selectors, const std::string &text, bool literal=false)
Test for a match.
void writeWrapped(OSstream &os, const std::string &str, const std::string::size_type width, const std::string::size_type indent=0, const bool escape=false)
Output string with text wrapping.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
void inplaceLower(std::string &s)
Inplace transform string with std::tolower on each character.
const dimensionedScalar c
Speed of light in a vacuum.
string removeComments(const std::string &s)
Return string with C/C++ comments removed.
Foam::SubStrings< StringType > splitSpace(const StringType &str, std::string::size_type pos=0)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC)
String expression evaluation.
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::argList args(argc, argv)
string expand(const std::string &s, const HashTable< string > &mapping, const char sigil='$')
Expand occurrences of variables according to the mapping and return the expanded string.