.. include:: ../substitutions
.. include:: ../../toolkit-substitutions

.. oe:namespace:: OESystem

.. meta::
   :keywords: OEStringToNumber

.. attention::

   |CPPONLY|

.. oe:function:: OEStringToNumber

   .. oe:api::

      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``.

.. seealso::

  .. oe:language:: c++

      * Example program :ref:`sdfilter.cpp<section_example_oechem_sdfilter>`

  .. oe:language:: python

      * Example program :ref:`sdfilter.py<section_example_oechem_sdfilter>`

  .. oe:language:: java

      * Example program :ref:`SDFilter.java<section_example_oechem_sdfilter>`

  .. oe:language:: csharp

      * Example program :ref:`SDFilter.cs<section_example_oechem_sdfilter>`
