Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper Tools . Books 1-3 - <b>cton()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 CTON()
 Converts a numeric string into a different base
------------------------------------------------------------------------------
 Syntax

     CTON(<cNumericstring>,[<nBase>],[<lMode>])
         --> nInteger

 Arguments

     <cNumericstring> Designates a numeric string to convert into a
     number in base <nBase>.

     <nBase>  Designates the number base to use in the conversion.  Can
     be in the range of 2 to 36.  The default is the decimal system, base 10.

     <lMode>  When designated as .T., allows a negative result.  The
     default allows only positive results.

 Returns

     CTON() returns the converted number that corresponds to the string.  The
     values lie in the range of 0 and 65535 or, if <lMode> is .T., in the
     range of -32768 and +32767.

 Description

     CTON() offers a number of ways to covert a number string into numeric
     data format.  Almost any number can be converted, as long as the base
     <nBase>  for the number system lies between 2 and 36.

 Notes

     .  The <cNumericstring> string is automatically TRIMmed left and
        right.

     .  If you have invalid parameters or combinations, the function
        returns a value of 0.

 Examples

     .  Convert to base 10:

        ? CTON("60000")                    // Result:  60000

     .  Convert to base 2:

        ? CTON("11", 2)                    // Result:  3

        ? CTON("1110101001100000", 2)      // Result:  60000

     .  Convert to base 16:

        CTON("A", 16)                      // Result:  10

        ? CTON("ABCD", 16)                 // Result:  43981

        ? CTON("FFFF", 16, .T.)            // Result:  -1

     .  Convert to base 36:

        ? CTON("XXP", 36)                  // Result:  43981


See Also: NTOC()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson