Returns true if the array contains the specified element.
1 array.contains
<array.contains name='name'>
<value /> !
</array.contains>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | string | Name of the variable of array type. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Evalue | object | This object is searched as a value within the array. If found, it is determined that the array contains the object and true is returned; otherwise it does not contain it and returns false. |
Returns | |
---|---|
Type | Description |
Boolean | Returns true if the object is in the array; false otherwise. |
See also
http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#contains(java.lang.Object)
Example
Determines if the array 'cities' contains the string value 'Barcelona'.
Copy
<xsql-script name='array_contains'> <body> <array name='cities'> <string>Barcelona</string> <string>Paris</string> <string>Roma</string> </array> <println> <!-- returns true --> <array.contains name='cities'> <string>Barcelona</string> </array.contains> </println> </body> </xsql-script>
The result is:
Copy
true