Skip to content

Errors for invalid range indexing into strings? #5446

@johnmyleswhite

Description

@johnmyleswhite

I might not appreciate the reasoning behind it, but I find the following behaviors for range indexing into strings a little odd:

julia> s = string('ñ')
"ñ"

julia> s[2]
ERROR: invalid UTF-8 character index

julia> s[2:2]
""

julia> s[20:20]
""

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs decisionA decision on this change is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions