find


Description:

[ Version ( since = "2.54" ) ]
public bool find (G needle, out uint index = null)

Checks whether needle exists in haystack.

If the element is found, true is returned and the element’s index is returned in index_ (if non-`NULL`). Otherwise, false is returned and index_ is undefined. If needle exists multiple times in haystack, the index of the first instance is returned.

This does pointer comparisons only. If you want to use more complex equality checks, such as string comparisons, use [ func@GLib.PtrArray.find_with_equal_func].

Parameters:

needle

the pointer to look for

haystack

the pointer array to be searched

index_

the return location for the index of the element, if found

Returns:

true if needle is one of the elements of haystack; false otherwise