Loading...
Searching...
No Matches
stringOps.H File Reference
Include dependency graph for stringOps.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Foam::stringOps
 Collection of static functions for various string-related operations.
namespace  Foam
 Namespace for OpenFOAM.

Functions

std::string::size_type count (const char *s, const char c)
 Count the number of occurrences of the specified character.
std::string::size_type count (const std::string &s, const char c)
 Count the number of occurrences of the specified character.
bool match (const UList< wordRe > &selectors, const std::string &text)
 True if text matches one of the selector expressions.
template<class StringType, class UnaryPredicate>
StringType quotemeta (const StringType &str, const UnaryPredicate &meta, const char quote='\\')
 Quote any meta-characters in given string.
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 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 inplaceExpand (std::string &s, const dictionary &dict, const bool allowEnv, const bool allowEmpty, const bool allowSubDict=false, const char sigil='$')
 Inplace expand occurrences of variables according to the dictionary and (optionally) environment variables.
string expand (const std::string &s, const dictionary &dict, const char sigil='$')
 Expand occurrences of dictionary or environment variables.
void inplaceExpand (std::string &s, const dictionary &dict, const char sigil='$')
 Inplace expand occurrences of dictionary or environment variables.
string expand (const std::string &s, const bool allowEmpty=false)
 Expand initial tags, tildes, and all occurrences of environment variables.
void inplaceExpand (std::string &s, const bool allowEmpty=false)
 Expand initial tags, tildes, and all occurrences of environment variables.
bool inplaceReplaceVar (std::string &s, const word &varName)
 Replace environment variable contents with its name.
template<class StringType, class UnaryPredicate>
StringType validate (const std::string &str, const UnaryPredicate &accept, const bool invert=false)
 Return a copy of the input string with validated characters.
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.
string trimLeft (const std::string &s)
 Return string trimmed of leading whitespace.
void inplaceTrimLeft (std::string &s)
 Trim leading whitespace inplace.
string trimRight (const std::string &s)
 Return string trimmed of trailing whitespace.
void inplaceTrimRight (std::string &s)
 Trim trailing whitespace inplace.
string trim (const std::string &s)
 Return string trimmed of leading and trailing whitespace.
void inplaceTrim (std::string &s)
 Trim leading and trailing whitespace inplace.
void inplaceRemoveSpace (std::string &s)
 Eliminate whitespace inplace.
string removeComments (const std::string &s)
 Return string with C/C++ comments removed.
void inplaceRemoveComments (std::string &s)
 Remove C/C++ comments inplace.
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.
string upper (const std::string &s)
 Return string copy transformed with std::toupper on each character.
void inplaceUpper (std::string &s)
 Inplace transform string with std::toupper on each character.
label splitFunctionArgs (const std::string &str, wordRes &args, List< Tuple2< word, string > > &namedArgs)
 Split out arguments (named or unnamed) from an input 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.
Foam::SubStrings split (const std::string &str, const std::string &delim, std::string::size_type pos=0, const bool keepEmpty=false)
 Split string into sub-strings using delimiter string.
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.
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.
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).
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.

Detailed Description

Original source file stringOps.H

Definition in file stringOps.H.