- All Implemented Interfaces:
- Function, Serializable
public class ContainsFunction
extends FunctionBase
implements Function
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" }
- See Also:
- Serialized Form