Difference between revisions of "SHIP:Sail:atoi"

From Serious Documentation
Jump to: navigation, search
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_Funtions|Sail String Functions]]
+
*[[SHIP:Sail:String_Functions|Sail String Functions]]
  
 
*{{SailFunc|atof}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}
 
*{{SailFunc|atof}}, {{SailFunc|ftoi}}, {{SailFunc|itof}}

Revision as of 15:35, 4 October 2016

Function Returns Introduced Description
atoi Integer 5.0.120 Parses a String to get an Integer from it Badge SHIPv5.gif

See Also:

Prototype

Integer atoi(String string);

Parameters/Return Value

Parameter Data Type Description
string String The string to parse
Return Integer the integer parsed value of the string

Detailed Description

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

Examples

Example Result Notes
atoi("-5"); -5
atoi("+5"); +5
atoi("5.76"); +5 Parsing stops at the first non-number, in this case the '.'
atoi("57X"); +57 Parsing stops at the X
atoi("P57X"); 0 An error, parsing stops at the P*

Categories: Numeric Functions Categories:String Functions

  • try/catch is targeted for introduction in SHIP v5.1 to detect this condition.