Files
mql5-skills/skills/mql5/references/docs/07-convert/0589-convert-stringtodouble.md
T
2026-06-23 21:47:51 +08:00

47 lines
1.3 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# StringToDouble
The function converts string containing a symbol representation of number into number of double type.
```
double  StringToDouble(
   string  value      // string
   );
```
Parameters
value
[in]  String containing a symbol representation of a number.
Return Value
Value of double type.
Example:
```
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- string to convert
   string str = "12345.54321";
//--- convert the input string as a real number into a double type variable
   double converted=StringToDouble(str);
//--- display the resulting number accurate to 8 decimal places in the journal
   PrintFormat("The string '%s' is converted to the real number %.8f", str, converted);
   /*
   result:
   The string '12345.54321' is converted to the real number 12345.54321000
   */
  }
```
See also
[NormalizeDouble](/en/docs/convert/normalizedouble), [Real types (double, float)](/en/docs/basis/types/double), [Typecasting](/en/docs/basis/types/casting)