- All Implemented Interfaces:
- Function
public class PadFunction
extends FunctionBase
implements Function
From http://docs.jsonata.org/string-functions.html:
$pad(str, width [, char])
Returns a copy of the string str with extra padding, if necessary, so that
its total number of characters is at least the absolute value of the width
parameter. If width is a positive number, then the string is padded to the
right; if negative, it is padded to the left. The optional char argument
specifies the padding character(s) to use. If not specified, it defaults to
the space character.
Examples
$pad("foo", 5)=="foo " $pad("foo", -5)==" foo" $pad("foo", -5, "#") ==
"##foo" $formatBase(35, 2) ~> $pad(-8, '0')=="00100011"