Dune Core Modules (2.6.0)
Utility functions for std::string. More...
Functions | |
template<typename C > | |
bool | Dune::hasPrefix (const C &c, const char *prefix) |
Check whether a character container has a given prefix. More... | |
template<typename C > | |
bool | Dune::hasSuffix (const C &c, const char *suffix) |
Check whether a character container has a given suffix. More... | |
template<class... T> | |
static std::string | Dune::formatString (const std::string &s, const T &... args) |
Format values according to printf format string. More... | |
Detailed Description
Utility functions for std::string.
Function Documentation
◆ formatString()
|
static |
Format values according to printf format string.
- Parameters
-
s The format string to be used args The valued to be formatted
This is a wrapper to std::snprintf that provides overflow save printf functionality. For up to 1000 characters a static buffer is used. If this is not sufficient a dynamic buffer of appropriate size is allocated.
References DUNE_THROW.
Referenced by Dune::GmshReaderParser< GridType >::pass1HandleElement(), and Dune::GmshReaderParser< GridType >::pass2HandleElement().
◆ hasPrefix()
bool Dune::hasPrefix | ( | const C & | c, |
const char * | prefix | ||
) |
Check whether a character container has a given prefix.
The container must support the begin() and size() methods.
Referenced by Dune::processPath(), and Dune::relativePath().
◆ hasSuffix()
bool Dune::hasSuffix | ( | const C & | c, |
const char * | suffix | ||
) |
Check whether a character container has a given suffix.
The container must support the begin() and size() methods and the const_iterator member type.
- Note
- This is slow for containers which don't have random access iterators. In the case of containers with bidirectional iterators, this slowness is unnecessary.
Referenced by Dune::concatPaths(), Dune::pathIndicatesDirectory(), and Dune::prettyPath().