Difference between revisions of "ParseNumber"

 
Line 23: Line 23:
 
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.
  
When x does not parse as a numeric value, such as ParseNum("hello"), returns [[«Null»]]
+
When x does not parse as a numeric value, such as ParseNum("hello"), returns [[«null»]]
  
 
ParseNum is often useful when reading data from flat files, using [[ReadCsvFile]] or [[ReadTextFile]].
 
ParseNum is often useful when reading data from flat files, using [[ReadCsvFile]] or [[ReadTextFile]].

Revision as of 21:05, 26 February 2009


New to Analytica 4.2 as a built-in function, but an equivalent library function, ParseNum can be used in Analytica 4.1.

ParseNumber(x)

Parses a string to a numeric value.

Library

Text Functions

Example

ParseNumber("3.14") → 3.14

Notes

If «x» is already numeric, «x» is returned.

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"), returns «null»

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

Comments


You are not allowed to post comments.