Attention

This functionality is only available in the C++ toolkits. For other languages, we recommend using language-specific functionality instead.

OEStringToNumber

bool OEStringToNumber(const std::string &str, bool &x)
bool OEStringToNumber(const std::string &str, std::string &x)
bool OEStringToNumber(const std::string &numstr, float &value)
bool OEStringToNumber(const std::string &numstr, double &value)
bool OEStringToNumber(const std::string &numstr, int &value, int base=10)
bool OEStringToNumber(const std::string &numstr, short &value, int base=10)
bool OEStringToNumber(const std::string &numstr, OELongLong &value, int base=10)
bool OEStringToNumber(const std::string &numstr, OEULongLong &value,
                      int base=10)
bool OEStringToNumber(const std::string &numstr, unsigned int &value,
                      int base=10)
bool OEStringToNumber(const std::string &numstr, unsigned short &value,
                      int base=10)

Attempts to convert the specified string into a numerical value in the specified base (‘base’) and store the generated value in the format appropriate to the passed parameter (‘value’). The function returns whether or not this conversion was successful. If the function fails, ‘value’ is set to 0.

See also