Skip to content

Error in 'str' documentation #11014

Closed
Closed
@wackywendell

Description

@wackywendell

The documentation for std::str::StrSlice::slice_chars gives the following example:

let s = "Löwe 老虎 Léopard";
assert_eq!(s.slice_chars(0, 4), "Löwe");
assert_eq!(s.slice_chars(6, 8), "老虎");

This does not work; the third line should be

assert_eq!(s.slice_chars(5, 7), "老虎");

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