@IsMember (JavaScript)

Indicates if a list contains a string or strings.

Defined in

@Functions (JavaScript)

Syntax

@IsMember(value:any, list:any) : int

@IsMember(value:string, list:any) : int

Parameter Description
value A string or list of strings. The value or values must match list elements exactly including case.
list The list to check against.
Return value Description
int 1 if list contains value, 0 otherwise.

Examples

This example tests a list to see if it contains strings and other lists. The first and third tests are true. The second and fourth tests are false.
function p(stuff) {
	print("<<<" + stuff + ">>>");
}

var cities = new Array("Paris", "Berlin", "London", "Moscow");
var cities1 = new Array("Berlin", "Moscow");
var cities2 = new Array("Berlin", "Vienna");

if(@IsMember("London", cities) == @True()) {
	p("London is member");
} else {
	p("London is not member");
}

if(@IsMember("Vienna", cities) == @True()) {
	p("Vienna is member");
} else {
	p("Vienna is not member");
}

if(@IsMember(cities1, cities) == @True()) {
	p(@Implode(cities1, "-") + " is member");
} else {
	p(@Implode(cities1, "-") + " is not member");
}

if(@IsMember(cities2, cities) == @True()) {
	p(@Implode(cities2, "-") + " is member");
} else {
	p(@Implode(cities2, "-") + " is not member");
}