StrToNum
Use this function to convert a character string to a numeric value.
You may find this function useful for comparison purposes. For example, suppose a complete account number in your system appears in the format A11234. You can use the StrToNum function to change any character strings to numeric values, so they can be compared correctly.
The value provided by your system depends on the format of the source item being converted:
Format of Source | Value of TargetSymName | Example |
---|---|---|
Symbol with numeric value |
An error message appears. |
String is a valid number. |
Empty character string |
An error message appears. |
Unable to convert string to number. |
Character string that cannot change to numeric value |
An error message appears. |
Unable to convert string to number. |
Syntax:
STRTONUM (SymName|"String")
where:
- SymName is the name of a symbol.
- String is a character string, enclosed in double quotation marks.
Syntax example:
AcctNum = STRTONUM ("11234")
Example:
CREATE VARIABLE NumTemp1 AS NUM
Variable = STRTONUM ("SourceString")
SET VARIABLE NumTemp1 = STRTONUM ("1234")
NumTemp1 will equal 1234 as a numeric value, not a string value.