$Pad: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (Mlarocca moved page $PAD to $Pad: Lower case change)
No edit summary
Line 1: Line 1:
<p>The $PAD function allows padding to the left with a designated character. The $PAD function takes three arguments and returns a character string of the length specified by the value of the third argument. The resulting string contains the first argument, right-justified, and padded with the character indicated in the second argument. The length argument is rounded if it is not an integral value. For example:  </p>
<p>The $PAD function allows padding to the left with a designated character. The $PAD function takes three arguments and returns a character string of the length specified by the value of the third argument. The resulting string contains the first argument, right-justified, and padded with the character indicated in the second argument. The length argument is rounded if it is not an integral value. For example:  </p>
<p>Many $functions have been antiquated by OO methods. The [[Right (String function)]] provides a left-padding feature similar to $pad.
</p>
<p class="code">$PAD('55449825','0',9) equals '055449825'
<p class="code">$PAD('55449825','0',9) equals '055449825'
$PAD('123.65','*',8) equals '**123.65'
$PAD('123.65','*',8) equals '**123.65'

Revision as of 17:43, 30 September 2016

The $PAD function allows padding to the left with a designated character. The $PAD function takes three arguments and returns a character string of the length specified by the value of the third argument. The resulting string contains the first argument, right-justified, and padded with the character indicated in the second argument. The length argument is rounded if it is not an integral value. For example:

Many $functions have been antiquated by OO methods. The Right (String function) provides a left-padding feature similar to $pad.

$PAD('55449825','0',9) equals '055449825' $PAD('123.65','*',8) equals '**123.65' $PAD('123.65','*',7.66) equals '**123.65'

  • If the value of the length argument is greater than 255, 255 is used.
  • If the value of the length argument is not greater than zero, a null string is returned.
  • If the second argument contains more than one character, the first character in the string is the one used for padding. For example:
  • $PAD('123.65','*4',8) equals '**123.65'