Extracted from Pike v7.8 release 866 at 2016-11-06.
pike.ida.liu.se
[Top]

Method has_index()


Method has_index

int has_index(string haystack, int index)
int has_index(array haystack, int index)
int has_index(mapping|multiset|object|program haystack, mixed index)

Description

Search for index in haystack .

Returns

Returns 1 if index is in the index domain of haystack , or 0 (zero) if not found.

This function is equivalent to (but sometimes faster than):

search(indices(haystack), index) != -1

Note

A negative index in strings and arrays as recognized by the index operators `[]() and `[]=() is not considered a proper index by has_index()

See also

has_value() , has_prefix() , has_suffix() , indices() , search() , values() , zero_type()