String Utilities
[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.
template<typename C >
bool Dune::hasSuffix (const C &c, const char *suffix)
 Check whether a character container has a given suffix.
template<class... T>
static std::string Dune::formatString (const std::string &s, const T &...args)
 Format values according to printf format string.

Detailed Description

Utility functions for std::string.


Function Documentation

template<class... T>
static std::string Dune::formatString ( const std::string &  s,
const T &...  args 
) [inline, 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.

template<typename C >
bool Dune::hasPrefix ( const C &  c,
const char *  prefix 
) [inline]

Check whether a character container has a given prefix.

The container must support the begin() and size() methods.

template<typename C >
bool Dune::hasSuffix ( const C &  c,
const char *  suffix 
) [inline]

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.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 25 Mar 2018 for dune-common by  doxygen 1.6.1