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 std::string &s, const char c)
 Count the number of occurrences of the specified character. More...
 
std::string::size_type count (const char *s, const char c)
 Count the number of occurrences of the specified character. More...
 
bool match (const UList< wordRe > &patterns, const std::string &text)
 Return true if text matches one of the regular expressions. More...
 
template<class StringType , class UnaryPredicate >
StringType quotemeta (const StringType &str, const UnaryPredicate &meta, const char quote='\\')
 Quote any meta-characters in given string. More...
 
string expand (const std::string &s, const HashTable< string > &mapping, const char sigil='$')
 
void inplaceExpand (std::string &s, const HashTable< string > &mapping, const char sigil='$')
 
void inplaceExpand (std::string &s, const dictionary &dict, const bool allowEnv, const bool allowEmpty, const bool allowSubDict=false, const char sigil='$')
 
string expand (const std::string &s, const dictionary &dict, const char sigil='$')
 Expand occurrences of dictionary or environment variables. More...
 
void inplaceExpand (std::string &s, const dictionary &dict, const char sigil='$')
 Inplace expand occurrences of dictionary or environment variables. More...
 
string expand (const std::string &s, const bool allowEmpty=false)
 
void inplaceExpand (std::string &s, const bool allowEmpty=false)
 
bool inplaceReplaceVar (std::string &s, const word &varName)
 Replace environment variable contents with its name. More...
 
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. More...
 
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. More...
 
string trimLeft (const std::string &s)
 Return string trimmed of leading whitespace. More...
 
void inplaceTrimLeft (std::string &s)
 Trim leading whitespace inplace. More...
 
string trimRight (const std::string &s)
 Return string trimmed of trailing whitespace. More...
 
void inplaceTrimRight (std::string &s)
 Trim trailing whitespace inplace. More...
 
string trim (const std::string &s)
 Return string trimmed of leading and trailing whitespace. More...
 
void inplaceTrim (std::string &s)
 Trim leading and trailing whitespace inplace. More...
 
void inplaceRemoveSpace (std::string &s)
 Eliminate whitespace inplace. More...
 
string removeComments (const std::string &s)
 Return string with C/C++ comments removed. More...
 
void inplaceRemoveComments (std::string &s)
 Remove C/C++ comments inplace. More...
 
string lower (const std::string &s)
 Return string copy transformed with std::tolower on each character. More...
 
void inplaceLower (std::string &s)
 Inplace transform string with std::tolower on each character. More...
 
string upper (const std::string &s)
 Return string copy transformed with std::toupper on each character. More...
 
void inplaceUpper (std::string &s)
 Inplace transform string with std::toupper on each character. More...
 
label splitFunctionArgs (const std::string &str, wordRes &args, List< Tuple2< word, string > > &namedArgs)
 Split out arguments (named or unnamed) from an input string. More...
 
template<class StringType >
Foam::SubStrings< StringType > split (const StringType &str, const char delim, const bool keepEmpty=false)
 Split string into sub-strings at the delimiter character. More...
 
template<class StringType >
Foam::SubStrings< StringType > split (const StringType &str, const std::string &delim, const bool keepEmpty=false)
 Split string into sub-strings using delimiter string. More...
 
template<class StringType >
Foam::SubStrings< StringType > splitAny (const StringType &str, const std::string &delim)
 Split string into sub-strings using any characters in delimiter. More...
 
template<class StringType >
Foam::SubStrings< StringType > splitFixed (const StringType &str, const std::string::size_type width, const std::string::size_type start=0)
 Split string into sub-strings using a fixed field width. More...
 
template<class StringType >
Foam::SubStrings< StringType > splitSpace (const StringType &str)
 Split string into sub-strings at whitespace (TAB, NL, VT, FF, CR, SPC) More...
 
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. More...
 

Detailed Description

Original source file stringOps.H

Definition in file stringOps.H.