Skip to content

Commit c0cc910

Browse files
authored
Rollup merge of #79860 - rust-lang:frewsxcv-patch-2, r=jyn514
Clarify that String::split_at takes a byte index. To someone skimming through the `String` docs and only reads the first line, the person could interpret "index" to be "char index". Later on in the docs it clarifies, but by adding "byte" it removes that ambiguity.
2 parents 8709ac8 + 33ae62c commit c0cc910

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: library/alloc/src/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ impl String {
14131413
self.len() == 0
14141414
}
14151415

1416-
/// Splits the string into two at the given index.
1416+
/// Splits the string into two at the given byte index.
14171417
///
14181418
/// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
14191419
/// the returned `String` contains bytes `[at, len)`. `at` must be on the

0 commit comments

Comments
 (0)