Go to the documentation of this file.
53 [[nodiscard]]
bool toDouble(
const std::string&
string,
double& value)
63 double value_new = std::strtod(
string.c_str(), &end);
65 if (errno != 0 || end !=
string.c_str() +
string.
length())
79 [[nodiscard]]
bool toFloat(
const std::string&
string,
float& value)
88 float value_new = std::strtof(
string.c_str(), &end);
90 if (errno != 0 || end !=
string.c_str() +
string.
length())
104 [[nodiscard]]
bool toInt32(
const std::string&
string, int32_t& value,
114 int64_t value_new = std::strtol(
string.c_str(), &end, base);
116 if (errno != 0 || end !=
string.c_str() +
string.
length())
121 if (value_new > std::numeric_limits<int32_t>::max() ||
122 value_new < std::numeric_limits<int32_t>::min())
127 value = (int32_t)value_new;
136 [[nodiscard]]
bool toUInt32(
const std::string&
string, uint32_t& value,
146 int64_t value_new = std::strtol(
string.c_str(), &end, base);
148 if (errno != 0 || end !=
string.c_str() +
string.
length())
153 if (value_new > std::numeric_limits<uint32_t>::max() || value_new < 0)
158 value = (uint32_t)value_new;
165 [[nodiscard]] int8_t
toInt8(
const std::string&
string, int8_t& value,
170 int64_t value_new = std::strtol(
string.c_str(), &end, base);
172 value = (int8_t)value_new;
179 [[nodiscard]] uint8_t
toUInt8(
const std::string&
string, uint8_t& value,
184 int64_t value_new = std::strtol(
string.c_str(), &end, base);
186 value = (uint8_t)value_new;
192 num = std::round(num * 1000);
194 std::stringstream ss;
196 ss << std::setprecision(3);
203 for (
size_t i = 0; i < str.size(); ++i)
205 if (std::isspace(str[i]))
bool toInt32(const std::string &string, int32_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever integer type your system h...
bool toDouble(const std::string &string, double &value)
Interprets the contents of "string" as a floating point number of type double It stores the "string"'...
std::string trimDecimalPlaces(double num)
Trims decimal places to three.
uint8_t toUInt8(const std::string &string, uint8_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your...
bool toUInt32(const std::string &string, uint32_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever unsigned integer type your...
bool containsSpace(const std::string str)
Checks if a string contains spaces.
Declares lower-level string utility functions used when parsing messages.
int8_t toInt8(const std::string &string, int8_t &value, int32_t base=10)
Interprets the contents of "string" as a floating point number of whatever integer type your system h...
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
bool toFloat(const std::string &string, float &value)
Interprets the contents of "string" as a floating point number of type float.