Tracking Issue for `str::first_char`, `str::split_first_char` et al.
Open
@F0RREALTHO is already working on this.
Since Mar 29, 2026.
C-tracking-issue
S-tracking-unimplemented
T-libs
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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 rust-lang/libs-team#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.)
- ACP: rust-lang/libs-team#764
- Implementation: #89603 (abandoned, not const)
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
_charsuffix or not?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.