pad
Summary
Returns a lengthened version of the input string.Usage
input|pad( length [, padding ] )
Parameters
Name | Type | Description | Required |
---|---|---|---|
length | integer | The desired length of the string. | Yes. |
padding | character | Custom character to be used for padding. | No. |
Returns
A padded version of the input string.Description
This operator makes sure that the input string is at least "length" characters long by inserting extra characters at the end. It is possible to specify a custom character using the "padding" parameter (default is space). The operator returns a padded version of the input string.
Examples
Example 1
{'Too short!'|pad( 15 )}
The following string will be produced: "Too short! ".
Example 2
{'Too short!'|pad( 16, '-' )}
The following string will be produced: "Too short!------".
Balazs Halasy (05/02/2004 10:58 am)
Balazs Halasy (04/05/2005 2:44 pm)
Comments
How to pad left?
Thursday 14 July 2005 11:14:39 am
Massimiliano Bariola