DiGrande.it

Blind, Braille and Embossing Technologies

This site uses cookies to personalize content and ads, provide social media features and analyze links. By closing this banner or continuing to browse, you consent to their use.
Read the DiGrande.it Cookie Policy

StringToNum- Converts the string into a numerical value

Function that converts the string containing the textual representation of the number in the relative numerical value.

- StringToNum(S[,D]): num

Parameters:

- (string) S: A string containing the textual representation of the number to be converted;

- (num) D: Default value in case of error (optional).

Description:

Use the StringToNum function to convert the text representation of a number to its numerical value. The result can be an integer or floating point number, depending on what the string contains. If the S string contains an invalid number, an error is generated. The optional parameter D is the default value that is returned if the number is invalid.

Examples:

// Stores the value of the string in the variable N

N = StringToNum('1234')

MsgBox(N)

// An error is generated because the string does not contain a valid number

N = StringToNum('123abc')

// The number -1 is returned because the string does not contain a valid number

N = StringToNum('123abc',-1)