Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

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.

Copy

Syntax

STRTONUM ("String")        

where:

  • String is a character string enclosed in double quotation marks.
Copy

Syntax example

AcctNum = STRTONUM ("11234")        
Copy

Code example

CREATE VARIABLE NumTemp1 AS NUMVariable = STRTONUM ("SourceString")SET VARIABLE NumTemp1 = STRTONUM ("1234")

// NumTemp1 will equal 1234 as a numeric value, not a string.        

Published:

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.

Copy

Syntax

STRTONUM ("String")        

where:

  • String is a character string enclosed in double quotation marks.
Copy

Syntax example

AcctNum = STRTONUM ("11234")        
Copy

Code example

CREATE VARIABLE NumTemp1 AS NUMVariable = STRTONUM ("SourceString")SET VARIABLE NumTemp1 = STRTONUM ("1234")

// NumTemp1 will equal 1234 as a numeric value, not a string.        

For an optimal Community experience, Please view on Desktop