Skip to content

Tracking Issue for str::first_char, str::split_first_char et al. #154393

@jdahlstrom

Description

@jdahlstrom

Feature gate: #![feature(str_first_last_char)]

This is a tracking issue for methods for extracting the first or last character of a str as a char. PR #89603 was submitted in 2021 (predating ACPs) but was closed after a few months due to author inactivity. ACP #764 proposes trying again to add these methods, this time constified.

Public API

// core::str

impl str {
    pub const fn first_char(&self) -> Option<char>
    pub const fn last_char(&self) -> Option<char>
    pub const fn split_first_char(&self) -> Option<(char, &str)>
    pub const fn split_last_char(&self) -> Option<(char, &str)>
}

Steps / History

(Remember to update the S-tracking-* label when checking boxes.)

Unresolved Questions

  • _char suffix or not?

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCS-tracking-unimplementedStatus: The feature has not been implemented.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    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