Description
Converts decimal numbers into integers (internal system format).
Syntax
internal = IConv (string, "MDn | MCn "[scale] [,] [or m or [mon] ] [- or < or C or D] [P] [Z] [T] [S] [xc]")
Caution: Do not allow spaces between arguments. Refer to the "Example" in this command description.
Parameters
IConv (MC, MD) accepts arguments for the following parameters.
Parameter | Description |
---|---|
string | Must be either a number or a variable that contains a number. |
MD, MC | MD indicates a masked decimal conversion. MC (Masked Comma) uses a "." (period) to separate thousands and a "," (comma) to separate the fractional portion of a decimal number. If you use the MC option, and if the value of string is a literal value (rather than a variable name), you must enclose string in quotation marks. |
N | A single digit, 0-F, indicates how many digits after the decimal to retain. Excess digits are rounded off. The decimal point does not appear in the data. A value for n is required. |
scale | A single digit, 0-9, indicates a scaling factor. The default is the value of n. If you specify a value for scale, string is multiplied by 10 to a factor of scale. When you use the OConv function to convert string for output, string is divided by 10 to a factor of scale. |
The remaining options in the syntax line have no effect on the IConv function. They are OConv options that are allowed in the IConv function so you can use the same specifications for both input and output conversions.
If string includes a multi-character currency symbol (for example, "Fr" for francs), you must specify that currency symbol in the IConv conversion.
Example
Celsius = 31.4 TEMP = IConv(Celsius, "MC2") *Assigns to Celsius the value "31400".
The following table provides examples of the correct use of the IConv Masked Decimal function.
Example | Output |
---|---|
IConv(64.24, "MD2") | 6424 |
IConv(-5, "MD1") | -50 |
IConv(64.24, "MD3") | 64240 |
IConv(143.5, "MD12") | 14350 |
IConv(143.5, "MD14") | 1435000 |
IConv(143.5, "MD0") | 144 |
IConv("1.234,5", "MC2.") | 123450 |
IConv("$45.50", "MD2") | 4550 |
IConv("45,25Fr", "MC2[Fr]S") | 4525 |