Class PadFunction
- java.lang.Object
-
- com.api.jsonata4java.expressions.functions.FunctionBase
-
- com.api.jsonata4java.expressions.functions.PadFunction
-
public class PadFunction extends FunctionBase
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"
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.api.jsonata4java.expressions.functions.FunctionBase
FunctionBase.CtxEvalResult
-
-
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
evalContext, getArgumentCount, getFunctionName
-
-
-
-
Method Detail
-
invoke
public com.fasterxml.jackson.databind.JsonNode invoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx)
- Specified by:
invokein classFunctionBase
-
getMaxArgs
public int getMaxArgs()
- Specified by:
getMaxArgsin classFunctionBase
-
getMinArgs
public int getMinArgs()
- Specified by:
getMinArgsin classFunctionBase
-
getSignature
public String getSignature()
- Specified by:
getSignaturein classFunctionBase
-
-