Findfirst and eachline

FWIW, the following options avoid collect():

for (i, r) in enumerate(eachline(file))
   contains(r, "Stack") && return i
end

or:

first(first(Iterators.filter(x -> contains(x[2], "Stack"), enumerate(eachline(file)))))

but not as simple/nice as the wished syntax.

2 Likes