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() can be used to expand or truncate the contents of string variables. PADC(), PADL(), and PADR() are the inverse of the Alltrim(), RTrim(), and LTrim() functions which remove leading and trailing space from character strings.
Examples
Pad('ABC', 10)
* Result := 'ABC '
____________________________
Related Topics: