contain()

Read(833) Label: contain,

Here’s how to use contain() function.

A. contain( x i ,… )

Description:

Check whether a given data object is a member of a certain sequence.

Syntax:

A.contain(xi,…)

Note:

The function checks whether parameter xi,… are members of sequence A or not; the number of parameters x is i. Return true if all parameters are members of sequence A, and false if not.

Parameter:

A

A sequence object or an expression that returns one

xi

Data object, which can be a number, a string or a sequence

Option:

@b

The option means that sequence A is ordered, based on which a binary search is performed in an ascending or descending order

Return value:

Boolean value

Example:

 

 

A

 

1

=[1,2,8,4,5,6,7,8]

 

2

=A1.contain(8)

true

3

=A1.contain(9)

false

4

=[1,2,3,4,5,6,7,8,9].contain@b(8)

Use binary search when the sequence is ordered; the result is true

5

=[[1,2,3,4,5,6,7,8],[3]].contain ([3])

true

6

[1,3,6,aaa]

 

7

=A6.contain("aaa")

true

8

=A1.contain(8,1)

true

9

=A1.contain(8,9)

false

Related functions:

  A.pos()