Skip to contents

Equivalent of .IndexOf() in Insight Maker.

Usage

indexof(haystack, needle)

Arguments

haystack

Vector or string to search through

needle

Value to search for

Value

Index, integer

Examples

indexof(c("a", "b", "c"), "b") # 2
#> [1] 2
indexof("haystack", "hay") # 1
#> [1] 1
indexof("haystack", "m") # 0
#> [1] 0