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 5.2 . The Guide To CA-Clippe - <b>pad()</b> http://www.X-Hacker.org [<<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 pad with a fill
     character.

     <nLength> is the length of the character string to return.

     <cFillChar> is the character to pad <exp> with.  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 assure 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: ALLTRIM() LTRIM() RTRIM()

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