Read Me - Common Public License V1.0 - Copyright Notice(©)

c2d


>>-c2d-+-----+-------------------------------------------------><
       +-(n)-+

Returns the decimal value of the binary representation of the receiving string. If the result cannot be expressed as a whole number, an error results. That is, the result must not have more digits than the current setting of NUMERIC DIGITS. If you specify [n] , it is the length of the returned result. If you do not specify [n] , the receiving string is processed as an unsigned binary number. If the receiving string is null, C2D returns 0.

String class - c2d method


"09"X~c2d       ->        9
"81"X~c2d       ->      129
"FF81"X~c2d     ->    65409
""~c2d          ->        0
"a"~c2d         ->       97     /*  ASCII   */

If you specify [n] , the receiving string is taken as a signed number expressed in [n] characters. The number is positive if the leftmost bit is off, and negative if the leftmost bit is on. In both cases, it is converted to a whole number, which can therefore be negative. The receiving string is padded on the left with "00"x characters (not "sign-extended"), or truncated on the left to [n] characters. This padding or truncation is as though receiving_string~right(n,'00'x) had been processed. If [n] is 0, [c2d] always returns 0.

String class - c2d method


"81"X~c2d(1)      ->     -127
"81"X~c2d(2)      ->      129
"FF81"X~c2d(2)    ->     -127
"FF81"X~c2d(1)    ->     -127
"FF7F"X~c2d(1)    ->      127
"F081"X~c2d(2)    ->    -3967
"F081"X~c2d(1)    ->     -127
"0031"X~c2d(0)    ->        0

Read Me - Common Public License V1.0 - Copyright Notice(©)