Go to: Synopsis. Return value. MEL examples.

Synopsis

int stringArrayContains(string $item, string[] $list)

Return true if array contains the item. The array may contain more than one occurrence of the item. This procedure will return true as soon as it finds one occurrence.

Return value

None

Arguments

Variable Name Variable Type Description
$itemstringThe string item to search for in the string array.
$liststring[]A list of string values.

MEL examples

  string $array1[] = {"item1", "item2", "item1"};
  // Result: item1 item2 item1 //

  int $found = stringArrayContains("item1", $array1);
  // Result: 1 //

  $count = stringArrayContains("item2", $array1);
  // Result: 1 //

  $count = stringArrayContains("plotz", $array1);
  // Result: 0 //