Difference between revisions of "SHIP:Sail:atof"

From Serious Documentation
Jump to: navigation, search
(Created page with "__NOTOC__ {{SailFuncTableStart|}}<onlyinclude> |{{SailFunc|atof}}||{{DataType|Integer}}||style="text-align:center;"|v5.0.120||Parses a string to get an integer from it</onlyin...")
 
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{SailFuncTableStart|}}<onlyinclude>
 
{{SailFuncTableStart|}}<onlyinclude>
|{{SailFunc|atof}}||{{DataType|Integer}}||style="text-align:center;"|v5.0.120||Parses a string to get an integer from it</onlyinclude>
+
|{{SailFunc|atof}}||{{DataType|Float}}||style="text-align:center;"|v5.0.120||Parses a {{DataType|String}} to get an {{DataType|Float}} from it</onlyinclude>
 
|}
 
|}
 
== See Also: ==
 
== See Also: ==
Line 7: Line 7:
 
*[[SHIP:Sail:Functions|Sail Functions]]
 
*[[SHIP:Sail:Functions|Sail Functions]]
 
*[[SHIP:Sail:Numeric Functions|Sail Numeric Functions]]
 
*[[SHIP:Sail:Numeric Functions|Sail Numeric Functions]]
 +
*[[SHIP:Sail:String_Functions|Sail String Functions]]
 +
 
*{{SailFunc|atoi}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}
 
*{{SailFunc|atoi}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}
 
== Prototype ==
 
== Prototype ==
<code>{{DataType|Integer}} {{SailFunc|atof}}({{DataType|String}} string);</code>
+
<code>{{DataType|Float}} {{SailFunc|atof}}({{DataType|String}} string);</code>
  
 
== Parameters/Return Value ==
 
== Parameters/Return Value ==
Line 21: Line 23:
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | Return
 
! scope="col" style="text-align:left" | {{DataType|Float}}
 
! scope="col" style="text-align:left" | {{DataType|Float}}
! scope="col" style="text-align:left" | the floating point parsed value of the string
+
! scope="col" style="text-align:left" | the floating point parsed value of the {{DataType|String}}
 
|}
 
|}
 
== Detailed Description ==
 
== Detailed Description ==
The <code>{{SailFunc|atof}}(string)</code> function returns the {{DataType|Float}} parsed value of a string which should contain the string version of an {{DataType|Float}} or {{DataType|Integer}}.
+
The <code>{{SailFunc|atof}}(string)</code> function returns the {{DataType|Float}} parsed value of a {{DataType|String}} which should contain the string version of an {{DataType|Float}} or {{DataType|Integer}}.
 
== Examples ==
 
== Examples ==
 
{| class="wikitable" style="margin: 1em 1em;"  
 
{| class="wikitable" style="margin: 1em 1em;"  
Line 44: Line 46:
 
|-
 
|-
 
|}
 
|}
 +
 +
[[Category:Numeric Functions]]
 +
[[Category:String Functions]]

Latest revision as of 10:05, 14 October 2016

Function Returns Introduced Description
atof Float v5.0.120 Parses a String to get an Float from it

See Also:

Prototype

Float atof(String string);

Parameters/Return Value

Parameter Data Type Description
string String The string to parse
Return Float the floating point parsed value of the String

Detailed Description

The atof(string) function returns the Float parsed value of a String which should contain the string version of an Float or Integer.

Examples

Example Result Notes
atof("-5"); -5.0
atof("+5"); +5.0
atof("5.76"); +5.76
atof("57.89E+3"); +5.789E+4
atof("0.005789E3"); +5.789
atof("57.8X9E+3"); 57.8 Parsing stops at the X