38 bool ToDouble(
const std::string&
string,
double& value)
47 double number = strtod(
string.c_str(), &end);
50 if (errno != 0 || end !=
string.c_str() +
string.length())
59 bool ToFloat(
const std::string&
string,
float& value)
68 float number = strtof(
string.c_str(), &end);
71 if (errno != 0 || end !=
string.c_str() +
string.length())
80 bool ToInt32(
const std::string&
string, int32_t& value, int32_t base)
89 int64_t number = strtol(
string.c_str(), &end, base);
92 if (errno != 0 || end !=
string.c_str() +
string.length())
97 if (number > std::numeric_limits<int32_t>::max() ||
98 number < std::numeric_limits<int32_t>::min())
107 bool ToUInt32(
const std::string&
string, uint32_t& value, int32_t base)
116 int64_t number = strtol(
string.c_str(), &end, base);
119 if (errno != 0 || end !=
string.c_str() +
string.length())
124 if (number > std::numeric_limits<uint32_t>::max() || number < 0)
bool ToInt32(const std::string &string, int32_t &value, int32_t base=10)
bool ToUInt32(const std::string &string, uint32_t &value, int32_t base=10)
bool ToFloat(const std::string &string, float &value)
bool ToDouble(const std::string &string, double &value)