Dune Core Modules (2.8.0)

String Utilities

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()

template<class... T>
static std::string Dune::formatString ( const std::string &  s,
const T &...  args 
)
static

Format values according to printf format string.

Parameters
sThe format string to be used
argsThe 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()

template<typename C >
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()

template<typename C >
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().

Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 22, 23:30, 2024)