omni::extras::stringToInteger

Defined in omni/extras/StringHelpers.h

inline bool omni::extras::stringToInteger(const std::string &str, int32_t &outResult)

Converts a given string to a 32-bit signed integer value.

Warning

This function will truncate values and may lose information even though true is returned. It’s use is not recommended.

Parameters
  • str – The string to convert. May be a decimal, hexadecimal (0x prefix) or octal (0 prefix) number. A floating point value may also be given including with exponential notation, though floating point values will be casted to an integer and may lose precision.

  • outResult[out] The reference that receives the integer result

Returns

true if strtoll or strtod parse str in its entirety; false otherwise. NOTE a return value of true does not mean that information or precision is not lost!