SHIP:Sail:atol

From Serious Documentation
Revision as of 10:11, 29 September 2016 by CarltonHeyer (talk | contribs) (Created page with "__NOTOC__ {{SailFuncTableStart|}}<onlyinclude> |{{SailFunc|atol}}||{{DataType|Long}}||style="text-align:center;"|5.1.0||Parses a {{DataType|String}} to get an {{DataType|Long}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function Returns Introduced Description
atol Long 5.1.0 Parses a String to get an Long from it Badge SHIPv5.gif

See Also:

Prototype

Long atol(String string);

Parameters/Return Value

Parameter Data Type Description
string String The string to parse
Return Long the long parsed value of the string

Detailed Description

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

Examples

Example Result Notes
atol("-5"); -5
atol("+5"); +5
atol("5.76"); +5 Parsing stops at the first non-number, in this case the '.'
atol("57X"); +57 Parsing stops at the X
atol("P57X"); 0 An error, parsing stops at the P*
  • try/catch is targeted for introduction in SHIP v5.1 to detect this condition.