import { fn } from "https://deno.land/x/ddc_vim@v4.1.0/deps.ts";
const { index } = fn;
Find {expr} in {object} and return its index. See
indexof()
for using a lambda to select the item.
If {object} is a List
return the lowest index where the item
has a value equal to {expr}. There is no automatic
conversion, so the String "4" is different from the Number 4.
And the number 4 is different from the Float 4.0. The value
of 'ignorecase' is not used here, case matters as indicated by
the {ic} argument.
If {object} is Blob
return the lowest index where the byte
value is equal to {expr}.
If {start} is given then start looking at the item with index {start} (may be negative for an item relative to the end).
When {ic} is given and it is TRUE
, ignore case. Otherwise
case must match.
-1 is returned when {expr} is not found in {object}. Example:
:let idx = index(words, "the")
:if index(numbers, 123) >= 0
Can also be used as a method
:
GetObject()->index(what)