Closed
Description
This is a tracking issue for split_inclusive
APIs for slice and str.
The feature gate for the issue is #![feature(split_inclusive)]
.
API overview
- Implement
split_inclusive
forslice
andstr
andsplit_inclusive_mut
forslice
split_inclusive
is a substring/subslice splitting iterator that includes the matched part in the iterated substrings as a terminator.- Two examples below:
let data = "\nMäry häd ä little lämb\nLittle lämb\n";
let split: Vec<&str> = data.split_inclusive('\n').collect();
assert_eq!(split, ["\n", "Märy häd ä little lämb\n", "Little lämb\n"]);
let uppercase_separated = "SheePSharKTurtlECaT";
let mut first_char = true;
let split: Vec<&str> = uppercase_separated.split_inclusive(|c: char| {
let split = !first_char && c.is_uppercase();
first_char = split;
split
}).collect();
assert_eq!(split, ["SheeP", "SharK", "TurtlE", "CaT"]);
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also uses as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
- Implement the RFC
- Adjust documentation
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
No known unresolved questions at the moment.
Implementation history
Implementation: #67330
Metadata
Metadata
Assignees
Labels
Area: `[T]`Area: str and StringBlocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFCLibs issues that are considered "small" or self-containedLibs issues that are tracked on the team's project board.Relevant to the library API team, which will review and decide on the PR/issue.