[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 PAD()
 Pad character, date, and numeric values with a fill character
------------------------------------------------------------------------------
 Syntax

     PADL(<exp>, <nLength>, [<cFillChar>])
        --> cPaddedString
     PADC(<exp>, <nLength>, [<cFillChar>])
        --> cPaddedString
     PADR(<exp>, <nLength>, [<cFillChar>])
        --> cPaddedString

 Arguments

     <exp> is a character, numeric, or date value to be padded with a
     fill character.

     <nLength> is the length of the character string to be returned.

     <cFillChar> is the character with which to pad <exp>.  If not
     specified, the default is a space character.

 Returns

     PADC(), PADL(), and PADR() return the result of <exp> as a character
     string padded with <cFillChar> to a total length of <nLength>.

 Description

     PADC(), PADL(), and PADR() are character functions that pad character,
     date, and numeric values with a fill character to create a new character
     string of a specified length.  PADC() centers <exp> within <nLength>
     adding fill characters to the left and right sides; PADL() adds fill
     characters on the left side; and PADR() adds fill characters on the
     right side.  If the length of <exp> exceeds <nLength>, all of the PAD()
     functions truncate cPaddedString to <nLength>.

     PADC(), PADL(), and PADR() display variable length strings within a
     fixed length area.  They can be used, for instance, to ensure alignment
     with consecutive ?? commands.  Another use is to display text to a fixed-
     width screen area assuring that previous text is completely overwritten.

     PADC(), PADL(), and PADR() are the inverse of the ALLTRIM(), RTRIM(),
     and LTRIM() functions which trim leading and trailing space from
     character strings.

 Examples

     .  This example uses PADR() to format a record number display on
        a status line filling the allocated space:

        IF EOF()
           @ 23, 45 PADR("EOF/" + LTRIM(STR(LASTREC())), 20)
        ELSEIF BOF()
           @ 23, 45 PADR("BOF/" + LTRIM(STR(LASTREC())), 20)
        ELSE
           @ 23, 45 SAY PADR("Record " + LTRIM(STR(RECNO()) ;
                 + "/" + LTRIM(STR(LASTREC())), 20)
        ENDIF

 Files   Library is EXTEND.LIB.


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