Class SplitFunction
java.lang.Object
com.api.jsonata4java.expressions.functions.FunctionBase
com.api.jsonata4java.expressions.functions.SplitFunction
From http://docs.jsonata.org/string-functions.html:
$split(str, separator [, limit])
Splits the str parameter into an array of substrings. If str is not
specified, then the context value is used as the value of str. It is an error
if str is not a string.
The separator parameter can either be a string or a regular expression
(regex). If it is a string, it specifies the characters within str about
which it should be split. If it is the empty string, str will be split into
an array of single characters. If it is a regex, it splits the string around
any sequence of characters that match the regex.
The optional limit parameter is a number that specifies the maximum number of
substrings to include in the resultant array. Any additional substrings are
discarded. If limit is not specified, then str is fully split with no limit
to the size of the resultant array. It is an error if limit is not a
non-negative number.
Examples
$split("so many words", " ")==[ "so", "many", "words" ] $split("so many
words", " ", 2)==[ "so", "many" ] $split("too much, punctuation. hard; to
read", "[ ,.;]+")==["too", "much", "punctuation", "hard", "to", "read"]
-
Nested Class Summary
Nested classes/interfaces inherited from class com.api.jsonata4java.expressions.functions.FunctionBase
FunctionBase.CtxEvalResult -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintcom.fasterxml.jackson.databind.JsonNodeinvoke(ExpressionsVisitor expressionVisitor, MappingExpressionParser.Function_callContext ctx) Methods inherited from class com.api.jsonata4java.expressions.functions.FunctionBase
evalContext, getArgumentCount, getFunctionName
-
Field Details
-
ERR_BAD_CONTEXT
-
ERR_ARG1BADTYPE
-
ERR_ARG2BADTYPE
-
ERR_ARG3BADTYPE
-
ERR_ARG4BADTYPE
-
-
Constructor Details
-
SplitFunction
public SplitFunction()
-
-
Method Details
-
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
- Specified by:
getSignaturein classFunctionBase
-