41 #ifndef Foam_stringOps_H 42 #define Foam_stringOps_H 60 template<
class T1,
class T2>
class Tuple2;
82 template<
class StringType,
class UnaryPredicate>
85 const StringType& str,
86 const UnaryPredicate& meta,
87 const char quote =
'\\' 98 const char sigil =
'$' 140 const char sigil =
'$' 212 const bool allowEmpty,
213 const bool allowSubDict =
false,
214 const char sigil =
'$' 226 const std::string&
s,
228 const char sigil =
'$' 250 const char sigil =
'$' 259 string expand(
const std::string&
s,
const bool allowEmpty =
false);
277 void inplaceExpand(std::string&
s,
const bool allowEmpty =
false);
287 template<
class StringType,
class UnaryPredicate>
290 const std::string& str,
291 const UnaryPredicate& accept,
297 std::pair<size_t, size_t>
300 const std::string&
s,
302 size_t len = std::string::npos
318 string trim(
const std::string&
s);
335 string lower(
const std::string&
s);
341 string upper(
const std::string&
s);
366 const std::string& str,
377 const std::string& str,
383 const bool keepEmpty =
false 391 const std::string& str,
393 const std::string& delim,
397 const bool keepEmpty =
false 406 const std::string& str,
408 const std::string& delim,
418 const std::string& str,
430 const std::string& str,
442 const std::string& str,
448 const bool escape =
false 460 #include "stringOps.txx" Generic output stream using a standard (STL) stream.
Ostream & indent(Ostream &os)
Indent stream.
Specialized string sorting.
Foam::SubStrings splitSpace(const std::string &str, std::string::size_type pos=0)
Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC)
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...
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.
Foam::SubStrings split(const std::string &str, const char delim, std::string::size_type pos=0, const bool keepEmpty=false)
Split string into sub-strings at the delimiter character.
std::string::size_type count(const char *s, const char c)
Count the number of occurrences of the specified character.
Foam::SubStrings splitAny(const std::string &str, const std::string &delim, std::string::size_type pos=0)
Split string into sub-strings using any characters in delimiter.
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.
void inplaceTrimRight(std::string &s)
Trim trailing whitespace inplace.
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.
string trimRight(const std::string &s)
Return string trimmed of trailing whitespace.
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)
string trimLeft(const std::string &s)
Return string trimmed of leading whitespace.
A class for handling words, derived from Foam::string.
StringType quotemeta(const StringType &str, const UnaryPredicate &meta, const char quote='\\')
Quote any meta-characters in given string.
A List of wordRe with additional matching capabilities.
string trim(const std::string &s)
Return string trimmed of leading and trailing whitespace.
void inplaceRemoveSpace(std::string &s)
Eliminate whitespace inplace.
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...
label splitFunctionArgs(const std::string &str, wordRes &args, List< Tuple2< word, string >> &namedArgs)
Split out arguments (named or unnamed) from an input string.
OBJstream os(runTime.globalPath()/outputName)
void inplaceRemoveComments(std::string &s)
Remove C/C++ comments inplace.
string upper(const std::string &s)
Return string copy transformed with std::toupper on each character.
labelList invert(const label len, const labelUList &map)
Create an inverse one-to-one mapping.
void inplaceUpper(std::string &s)
Inplace transform string with std::toupper on each character.
static bool match(const UList< wordRe > &selectors, const std::string &text, bool literal=false)
Test for a match of any selectors against the text.
void inplaceTrimLeft(std::string &s)
Trim leading whitespace inplace.
bool inplaceReplaceVar(std::string &s, const word &varName)
Replace environment variable contents with its name.
void inplaceTrim(std::string &s)
Trim leading and trailing whitespace inplace.
const dimensionedScalar c
Speed of light in a vacuum.
string lower(const std::string &s)
Return string copy transformed with std::tolower on each character.
Foam::SubStrings splitFixed(const std::string &str, const std::string::size_type width, std::string::size_type pos=0)
Split string into sub-strings using a fixed field width.
void inplaceLower(std::string &s)
Inplace transform string with std::tolower on each character.
String expression evaluation.
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...
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.
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 removeComments(const std::string &s)
Return string with C/C++ comments removed.