Class PadFunction
- java.lang.Object
-
- com.api.jsonata4java.expressions.functions.FunctionBase
-
- com.api.jsonata4java.expressions.functions.PadFunction
-
- All Implemented Interfaces:
Function,Serializable
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"- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringERR_ARG1BADTYPEstatic StringERR_ARG2BADTYPEstatic StringERR_ARG3BADTYPEstatic StringERR_ARG4BADTYPEstatic StringERR_BAD_CONTEXT
-
Constructor Summary
Constructors Constructor Description PadFunction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxArgs()intgetMinArgs()StringgetSignature()com.fasterxml.jackson.databind.JsonNodeinvoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx)static StringleftPad(String str, int size, String padStr)static StringrightPad(String str, int size, String padStr)-
Methods inherited from class com.api.jsonata4java.expressions.functions.FunctionBase
getArgumentCount, getFunctionName
-
-
-
-
Method Detail
-
invoke
public com.fasterxml.jackson.databind.JsonNode invoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx)
-
getMaxArgs
public int getMaxArgs()
- Specified by:
getMaxArgsin interfaceFunction
-
getMinArgs
public int getMinArgs()
- Specified by:
getMinArgsin interfaceFunction
-
getSignature
public String getSignature()
- Specified by:
getSignaturein interfaceFunction
-
-