[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 NTOC()
 Converts the numbers in a digit string into a different number base
------------------------------------------------------------------------------
 Syntax

     NTOC(<nLONG|cHexLONG>,[<nBase>],[<nLength>],
        [<cPad>]) --> cCharacterstring

 Arguments

     <nLONG|cHexLONG>  Corresponds to a decimal number or hexadecimal
     character string to convert.

     <nBase>  Designates the number system base, from 2 to 36
     (inclusive), to use in the result.  The default is the decimal system,
     base 10.

     <nLength>  Designates the length of the string that results.  The
     maximum length is 255.  The default is the length required for the
     conversion.

     <cPad>  Designates a pad character to pad the string result on the
     left.  The default value is a space.

 Returns

     NTOC() returns a character string that contains the conversion result of
     <nLONG|cHexLONG> into the <nBase> number system.

 Description

     NTOC() converts a decimal number or hexadecimal string into a number
     string.  The result is a number in base <nBase> or, if <nBase> is not
     specified, in base 10.  Use <nLength> to determine the length of the
     result string.  However, if <nLength> is longer than the length
     necessary for the result, the result string is padded on the left with
     spaces or with a character selected with <cPad>.

 Note

     .  If incompatible parameter combinations are specified, NTOC()
        returns one or more asterisks (*) as a result.

 Examples

     .  Convert to base 10:

        ? NTOC (60000)                //"60000"
        ? NTOC (60000, 10, 7)         //"    60000"

     .  Convert to base 2:

        ? NTOC(60000, 2)              // "1110101001100000"
        ? NTOC("FFFF", 2)             // "1111111111111111"
        ? NTOC("30", 2, 8, "0")       // "00110000"

     .  Convert to base 16:

        ? NTOC(43981, 16)             // "ABCD"

     .  Convert to base 36:

        ? NTOC(43981, 36, 4)          // "XXP"

     .  Invalid parameters (overflow):

        ? NTOC("GGGG", 2)             // "*"
        ? NTOC(60000, 10, 3)          // "***"
        ? NTOC(60000, 1, 4)           // "****"


See Also: CTON()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson