Skip to content

findnext should use iteration #16538

Closed
Closed
@Keno

Description

@Keno

Currently, it tries to access invalid elements:

julia> findfirst(x->x=='0', "⨳⨳")
ERROR: UnicodeError: invalid character index
 in next(::String, ::Int64) at ./unicode/utf8.jl:65
 in getindex at ./strings/basic.jl:58 [inlined]
 in findnext(::##25#26, ::String, ::Int64) at ./array.jl:748
 in findfirst(::Function, ::String) at ./array.jl:754
 in eval(::Module, ::Any) at ./boot.jl:225
 in macro expansion at ./REPL.jl:92 [inlined]
 in (::Base.REPL.##1#2{Base.REPL.REPLBackend})() at ./event.jl:46

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions