Changeset 72:d711540c0dff in rrlib_util


Ignore:
Timestamp:
26.10.2012 16:04:56 (7 years ago)
Author:
Jochen Hirth <hirth@…>
Branch:
default
Phase:
public
Message:

added method to convert a hex number represented as std::string into a dec number.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sStringUtils.h

    r62 r72  
    352352    s = os.str(); 
    353353  } 
     354  /*! 
     355   * \brief Converting a std::string representing a hexadecimal number into a decimal number 
     356   * \param string representing hexadecimal number 
     357   */ 
     358 
     359  template<class T> 
     360  static T HexStringToDecNumber(std::string str) 
     361  { 
     362    std::istringstream iss(str); 
     363    T result = 0; 
     364    iss >> std::hex >> result; 
     365    return result; 
     366  } 
     367 
    354368 
    355369  /*! 
Note: See TracChangeset for help on using the changeset viewer.