Returns the given string right-padded to the given length.
If the length of s is at least totalWidth, then a new String identical to s is returned. Otherwise, s will be padded on the right with as many paddingChar characters as needed to create a length of totalWidth.
Note that only the first character of paddingChar will be used when padding the result.
Exception Type | Condition |
---|---|
ArgumentException | totalWidth is less than zero. |
string::pad-right('test', 10, ' ') ==> 'test '
string::pad-right('test', 10, 'abcd') ==> 'testaaaaaa'
string::pad-right('test', 3, ' ') ==> 'test'
string::pad-right('test', -3, ' ') ==> ERROR
StringFunctions Class | NAnt.Core.Functions Namespace