Skip to content

String index not correct #2895

@frank-king

Description

@frank-king

Feature

RustPython

>>>>> '日月abc'.index('a')
6
>>>>>

Cpython

>>> '日月abc'.index('a')
2
>>> 

It is probably because the str.find in Rust returns the index of byte, instead of the code point.

I'll try fix this.

Python Documentation

https://docs.python.org/3.8/library/stdtypes.html?highlight=str#str.index

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions