changed all std::atof() to uStr2Float() to fix locale comma float conversion problem

This commit is contained in:
Mathieu Labbe
2015-02-04 21:20:17 -05:00
parent f8b625c7c7
commit 3d1eccbce1
15 changed files with 75 additions and 38 deletions

View File

@@ -113,6 +113,24 @@ std::string uNumber2Str(double number)
return s.str();
}
float uStr2Float(const std::string & str)
{
float value = 0.0f;
std::istringstream istr(uReplaceChar(str, ',', '.').c_str());
istr.imbue(std::locale("C"));
istr >> value;
return value;
}
double uStr2Double(const std::string & str)
{
double value = 0.0;
std::istringstream istr(uReplaceChar(str, ',', '.').c_str());
istr.imbue(std::locale("C"));
istr >> value;
return value;
}
std::string uBool2Str(bool boolean)
{
std::string s;