OpenMS  2.8.0
Classes | Static Public Member Functions | Static Private Attributes | List of all members
StringUtilsHelper Class Reference

#include <OpenMS/DATASTRUCTURES/StringUtils.h>

Collaboration diagram for StringUtilsHelper:
[legend]

Classes

struct  real_policies_NANfixed_
 

Static Public Member Functions

static Int toInt (const String &this_s)
 Functions. More...
 
static float toFloat (const String &this_s)
 
static double toDouble (const String &s)
 convert String (leading and trailing whitespace allowed) to double More...
 
template<typename IteratorT >
static bool extractDouble (IteratorT &begin, const IteratorT &end, double &target)
 

Static Private Attributes

static boost::spirit::qi::real_parser< double, real_policies_NANfixed_< double > > parse_double_
 
static boost::spirit::qi::real_parser< float, real_policies_NANfixed_< float > > parse_float_
 

Member Function Documentation

◆ extractDouble()

static bool extractDouble ( IteratorT &  begin,
const IteratorT &  end,
double &  target 
)
inlinestatic

Reads a double from an iterator position. The begin iterator is modified (advanced) if parsing was successful. The target only contains a valid result if the functions returns true (i.e. parsing succeeded). Whitespaces before and after the double are NOT consumed!

Referenced by OpenMS::StringUtils::extractDouble().

◆ toDouble()

static double toDouble ( const String s)
inlinestatic

convert String (leading and trailing whitespace allowed) to double

s Input string which represents a double, e.g. " 12.3 "

Returns
A double representation of s
Exceptions
Exception::ConversionErrorif the string is not completely explained by the double (whitespaces are allowed)

Referenced by OpenMS::StringUtils::toDouble().

◆ toFloat()

static float toFloat ( const String this_s)
inlinestatic

◆ toInt()

static Int toInt ( const String this_s)
inlinestatic

Functions.

Referenced by OpenMS::StringUtils::toInt().

Member Data Documentation

◆ parse_double_

boost::spirit::qi::real_parser<double, real_policies_NANfixed_<double> > parse_double_
staticprivate

◆ parse_float_

boost::spirit::qi::real_parser<float, real_policies_NANfixed_<float> > parse_float_
staticprivate