Difference between revisions of "ParseNumber"
m (→Notes) |
|||
Line 3: | Line 3: | ||
[[Category:Doc Status D]] <!-- For Lumina use, do not change --> | [[Category:Doc Status D]] <!-- For Lumina use, do not change --> | ||
− | + | ==ParseNumber(x) == | |
− | + | Parses input string «x» to a numeric value. If «x» is already numeric, «x» is returned. When «x» does not parse as a numeric value, such as <code>ParseNumber("hello")</code>, returns [[Null]]. | |
− | = | ||
− | |||
− | Parses | ||
− | |||
− | |||
+ | == Library == | ||
Text Functions | Text Functions | ||
− | = Example = | + | == Example == |
− | + | :<code>ParseNumber]]("3.14") → 3.14</code> | |
− | |||
− | |||
− | |||
− | |||
− | |||
+ | == Notes == | ||
An array can be passed, in which each cell of the array is parsed. | An array can be passed, in which each cell of the array is parsed. | ||
− | + | [[ParseNumber]] is often useful when reading data from flat files, using [[ReadCsvFile]] or [[ReadTextFile]]. | |
− | |||
− | |||
Coercion to numeric can be accomplished in Analytica in other ways. For example, you can declare a function parameter with the [[Function Parameter Qualifiers|qualifiers]] "coerce numeric". Then a string value passed to that parameter is parsed. The calling variable needs to have a non-date number format, since the number format of the calling object determines how the value is interpreted. | Coercion to numeric can be accomplished in Analytica in other ways. For example, you can declare a function parameter with the [[Function Parameter Qualifiers|qualifiers]] "coerce numeric". Then a string value passed to that parameter is parsed. The calling variable needs to have a non-date number format, since the number format of the calling object determines how the value is interpreted. | ||
− | = | + | ==History== |
+ | [[ParseNumber]] is new to [[What's new in Analytica 4.2?|Analytica 4.2]] as a built-in function, but an equivalent library function, [[ParseNum]] can be used in Analytica 4.1. | ||
+ | == See Also == | ||
* [[ParseDate]] | * [[ParseDate]] | ||
− | * [[ReadTextFile]] | + | * [[ReadTextFile]] |
+ | * [[ReadCsvFile]] | ||
* [[Function Parameter Qualifiers]] (especially the '''coerce''' qualifier) | * [[Function Parameter Qualifiers]] (especially the '''coerce''' qualifier) |
Revision as of 22:03, 14 January 2016
ParseNumber(x)
Parses input string «x» to a numeric value. If «x» is already numeric, «x» is returned. When «x» does not parse as a numeric value, such as ParseNumber("hello")
, returns Null.
Library
Text Functions
Example
ParseNumber]]("3.14") → 3.14
Notes
An array can be passed, in which each cell of the array is parsed.
ParseNumber is often useful when reading data from flat files, using ReadCsvFile or ReadTextFile.
Coercion to numeric can be accomplished in Analytica in other ways. For example, you can declare a function parameter with the qualifiers "coerce numeric". Then a string value passed to that parameter is parsed. The calling variable needs to have a non-date number format, since the number format of the calling object determines how the value is interpreted.
History
ParseNumber is new to Analytica 4.2 as a built-in function, but an equivalent library function, ParseNum can be used in Analytica 4.1.
See Also
- ParseDate
- ReadTextFile
- ReadCsvFile
- Function Parameter Qualifiers (especially the coerce qualifier)
Enable comment auto-refresher