Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Clipper Tools One Guide - <b>ntoc()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
NTOC()

Syntax:     NTOC(<expH>[,<expN1>][,<expN2>][,<expC>])

Arguments:  <expH> is either a decimal number or a string of
            hexadecimal digits.
            <expN1> denotes the base to be used for the result.
            <expN2> denote the length of the resulting string.
            <expC> is the character to use to pad the left-hand side of
            the resulting string.  A space is assumed if no argument is
            passed.

Returns:    A character value.
            A string containing the result of the conversion of <expH> in
            the base denoted by <expN1>.

Usage:      NTOC() can convert any decimal number or a hexadecimal
            into a character string of of digits.  The result is a
            number in base <expN1>.  If <expN1> is omitted, base 10 is
            assumed.  <expN1> determines the length of the string to be
            returned.  The left-hand side of the resulting string will be
            padded with the character <expC> to the size denoted by
            <expN2>.

Notes:      The base <expN1> may lie in the range of 2 to 36 inclusive;
            the length <expN2> may be between 1 and 255 inclusive.  If
            inconsistent combinations of arguments are indicated, then
            NTOC() will return one or more "*".

Library:    CT1.LIB


--------------------------------- Example ------------------------------

Examples:   * Conversion to base 10
            ? NTOC(60000)               && "60000"
            ? NTOC(60000,10,7)          && "600000"

            * Conversion to base 2
            ? NTOC(60000,2)             && "1110101001100000"
            ? NTOC("FFFF",2)            && "1111111111111111"
            ? NTOC(30,2,8,"0")          && "00110000"

            * Conversion to base 16
            ? NTOC(43981,16)            && "ABCD"

            * Conversion to base 36
            ? NTOC(43981,36,4)          && "XXP"

            * Invalid arguments
            ? NTOC("GGGG",2)            && "*"
            ? NTOC(60000,10,3)          && "***"
            ? NTOC(60000,1,4)           && "****"




See Also: CTON()

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