mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2003 Move conversion from string to double into RiaStdStringTools
This commit is contained in:
@@ -54,3 +54,16 @@ int RiaStdStringTools::toInt(const std::string& s)
|
||||
|
||||
return intValue;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
double RiaStdStringTools::toDouble(const std::string& s)
|
||||
{
|
||||
double doubleValue = -1.0;
|
||||
|
||||
char* end;
|
||||
doubleValue = std::strtod(s.data(), &end);
|
||||
|
||||
return doubleValue;
|
||||
}
|
||||
|
||||
@@ -30,5 +30,6 @@ public:
|
||||
static bool isNumber(const std::string& s);
|
||||
|
||||
static int toInt(const std::string& s);
|
||||
static double toDouble(const std::string& s);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user