distof
(distof string [mode])
The distof function converts a given string, interpreted as real value, to a floating-point number value depending on the argument mode.
Arguments
string is a string to be interpreted as a real number.
mode specifies the format of the given string containing the unit mode for linear conversion.
The value given in mode is interpreted as follows:
Mode |
Format |
-1 |
The current linear units setting (value of the LUNITS system variable) is used . It can be one of the following settings (1 to 5). |
1 |
Scientific representation |
2 |
Decimal |
3 |
English: Engineering (feet/inches) |
4 |
English: Architectural (feet/fractional inches) |
5 |
English: Fractional |
If the mode argument is omitted, the function uses the current linear units setting (value of the LUNITS system variable).
Return Value
If the function succeeds, it returns a real number; otherwise, it returns nil.
: (distof "1.234E02" 1) ; 1 = scientific representation
123.4000
: (distof "123.4" 2) ; 2 = decimal
123.4000
: (distof "10'-3.4\"" 3) ; 3 = engineering
123.4000
: (distof "10'-3 6/16\"" 4) ; 4 = architectural
123.3750
: (distof "123 6/16" 5) ; 5 = fractional
123.3750