Difference between revisions of "ParseNum"
m |
|||
(4 intermediate revisions by one other user not shown) | |||
Line 2: | Line 2: | ||
[[Category:Data Type Functions]] | [[Category:Data Type Functions]] | ||
[[Category: Flat File library functions]] | [[Category: Flat File library functions]] | ||
− | [[Category:Doc Status D]] <!-- For Lumina use, do not change --> | + | [[Category:Doc Status D]] |
+ | <nowiki> </nowiki><!-- For Lumina use, do not change -->ParseNum (a function in the Flat File Library) is '''obsolete''', since it was replaced by the built-in function, [[ParseNumber]]. | ||
== ParseNum(x) == | == ParseNum(x) == | ||
− | + | Converts text «x» to a numeric value. If «x» is already numeric, it returns «x». | |
== Library == | == Library == | ||
+ | [[media:Flat File Library.ana|Flat File Library.ana]] | ||
− | + | :(Use [[File menu|File]] → '''Add Library...''' to add this library) | |
− | |||
− | (Use | ||
== Example == | == Example == | ||
Line 28: | Line 28: | ||
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. | ||
− | |||
− | |||
== See Also == | == See Also == | ||
* [[media:Flat File Library.ana|Flat File Library.ana]] | * [[media:Flat File Library.ana|Flat File Library.ana]] | ||
+ | * [[Numbers]] | ||
* [[ParseNumber]] | * [[ParseNumber]] | ||
* [[ParseDate]] | * [[ParseDate]] | ||
+ | * [[Parsed Expressions]] | ||
* [[Number format]] | * [[Number format]] | ||
* [[NumberToText]] | * [[NumberToText]] |
Latest revision as of 03:50, 25 August 2016
ParseNum (a function in the Flat File Library) is obsolete, since it was replaced by the built-in function, ParseNumber.
ParseNum(x)
Converts text «x» to a numeric value. If «x» is already numeric, it returns «x».
Library
- (Use File → Add Library... to add this library)
Example
ParseNum("3.14") → 3.14
Notes
An array can be passed, in which each cell of the array is parsed.
When «x» does not parse as a numeric value, such as ParseNum("hello")
, the following error occurs:
Evaluation Error: In the call to function Coerce_to_numeric, a value passed to the first parameter, x, could not be coerced to type Numeric, while evaluating function ParseNum.
ParseNum 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.
See Also
- Flat File Library.ana
- Numbers
- ParseNumber
- ParseDate
- Parsed Expressions
- Number format
- NumberToText
- ReadTextFile
- ReadCsvFile
- Function Parameter Qualifiers (especially the coerce qualifier)
Enable comment auto-refresher