Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Harbour Version 0.37 (c) reference Guid - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

STRZERO()

Convert a numeric expression to a character string, zero padded.
---------------------------------------------------------------------------------

 Syntax

        STRZERO(<nNumber>, [<nLength>], [<nDecimals>]) --> cNumber  

 Arguments

        <nNumber>   is the numeric expression to be converted to a 
                  character string.

        <nLength>   is the length of the character string to return, 
                  including decimal digits, decimal point, and sign.

        <nDecimals>   is the number of decimal places to return.    

 Returns

        STRZERO()   returns <nNumber> formatted as a character string.  
                  If the optional length and decimal arguments are not
                  specified, STRZERO()  returns the character string
                  according to the following rules:

       Results  of STRZERO() with No Optional Arguments      

      +------------------------------------------------------------+
      | Expression            | Return Value Length                |
      |-----------------------+------------------------------------|
      | Field Variable        | Field length plus decimals         |
      | Expressions/constants | Minimum of 10 digits plus decimals |
      | VAL()                 | Minimum of 3 digits                |
      | MONTH()/DAY()         | 3 digits                           |
      | YEAR()                | 5 digits                           |
      | RECNO()               | 7 digits                           |
      +------------------------------------------------------------+

 Description

      STRZERO() is a numeric conversion function that converts numeric
      values  to character strings. It is commonly used to concatenate
      numeric values  to character strings. STRZERO() has applications
      displaying numbers,  creating codes such as part numbers from
      numeric values, and creating  index keys that combine numeric and
      character data.

      STRZERO() is like TRANSFORM(), which formats numeric values as
      character  strings using a mask instead of length and decimal
      specifications.

      The inverse of STRZERO() is VAL(), which converts character numbers
      to  numerics.

      *  If <nLength> is less than the number of whole number digits in
      <nNumber>, STR() returns asterisks instead of the number.

      *  If <nLength> is less than the number of decimal digits  required
      for the decimal portion of the returned string, Harbour  rounds the
      number to the available number of decimal places.

      *  If <nLength> is specified but <nDecimals> is omitted (no  decimal
      places), the return value is rounded to an integer.

 Examples

      ? STRZERO( 10, 6, 2 ) // "010.00"
      ? STRZERO( -10, 8, 2 ) // "-0010.00"
  

 Tests

      see the regression test suit for comprehensive tests.
  

Status

      Ready

 Compliance

      CA-Clipper compatible (it was not mentioned in the docs though).

 Files

      Library is rtl



See Also: STR()

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