Class FormatNumberFunction
- java.lang.Object
-
- com.api.jsonata4java.expressions.functions.FunctionBase
-
- com.api.jsonata4java.expressions.functions.FormatNumberFunction
-
public class FormatNumberFunction extends FunctionBase
From http://docs.jsonata.org/string-functions.html: $formatNumber(number, picture [, options]) Casts the number to a string and formats it to a decimal representation as specified by the picture string. The behaviour of this function is consistent with the XPath/XQuery function fn:format-number as defined in the XPath F&O 3.1 specification. The picture string parameter defines how the number is formatted and has the same syntax as fn:format-number. The optional third argument options is used to override the default locale specific formatting characters such as the decimal separator. If supplied, this argument must be an object containing name/value pairs specified in the decimal format section of the XPath F&O 3.1 specification. Examples $formatNumber(12345.6, '#,###.00')=="12,345.60" $formatNumber(1234.5678, "00.000e0")=="12.346e2" $formatNumber(34.555, "#0.00;(#0.00)")=="34.56" $formatNumber(-34.555, "#0.00;(#0.00)")=="(34.56)" $formatNumber(0.14, "01%")=="14%" $formatNumber(0.14, "###pm", {"per-mille": "pm"})=="140pm" $formatNumber(1234.5678, "①①.①①①e①", {"zero-digit": ""})=="①②.③④⑥e②"
-
-
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 FormatNumberFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMaxArgs()intgetMinArgs()StringgetSignature()com.fasterxml.jackson.databind.JsonNodeinvoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx)-
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
-
-