Class ContainsFunction
java.lang.Object
com.api.jsonata4java.expressions.functions.FunctionBase
com.api.jsonata4java.expressions.functions.ContainsFunction
From http://docs.jsonata.org/string-functions.html:
$contains(str, pattern)
Returns true if str is matched by pattern, otherwise it returns false. If str
is not specified (i.e. this function is invoked with one argument), then the
context value is used as the value of str.
The pattern parameter can either be a string or a regular expression (regex).
If it is a string, the function returns true if the characters within pattern
are contained contiguously within str. If it is a regex, the function will
return true if the regex matches the contents of str.
Examples
$contains("abracadabra", "bra")==true $contains("abracadabra", /a.*a/) ==
true $contains("abracadabra", /ar.*a/)==false $contains("Hello World",
/wo/)==false $contains("Hello World", /wo/i)==true
Phone[$contains(number, /^077/)]=={ "type": "mobile", "number": "077 7700
1234" }
-
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
-
s_objectMapper
public static com.fasterxml.jackson.databind.ObjectMapper s_objectMapper
-
-
Constructor Details
-
ContainsFunction
public ContainsFunction()
-
-
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
-