array_index

Finds a value in a array.

@property @trusted
ptrdiff_t
array_index
(
T
E
)
(,
E[] array
)

Parameters

value T

the value to be searched in the array

array E[]

the array to search into

Return Value

Type: ptrdiff_t

the index where the value has been found, -1 otherwise

Examples

assert(array_index(1, [1, 2, 3] == 0));
assert(array_index(0, [1, 2, 3] == -1));
assert("test".indexOf('e') == 1);

Meta