@@ -1250,17 +1250,17 @@ impl String {
1250
1250
self . len ( ) == 0
1251
1251
}
1252
1252
1253
- /// Divide one string into two at an index.
1253
+ /// Splits the string into two at the given index.
1254
1254
///
1255
- /// The argument, `mid`, should be a byte offset from the start of the string. It must also
1256
- /// be on the boundary of a UTF-8 code point.
1255
+ /// Returns a newly allocated `String`. `self` contains bytes `[0, at)`, and
1256
+ /// the returned `String` contains bytes `[at, len)`. `at` must be on the
1257
+ /// boundary of a UTF-8 code point.
1257
1258
///
1258
- /// The two strings returned go from the start of the string to `mid`, and from `mid` to the end
1259
- /// of the string.
1259
+ /// Note that the capacity of `self` does not change.
1260
1260
///
1261
1261
/// # Panics
1262
1262
///
1263
- /// Panics if `mid ` is not on a `UTF-8` code point boundary, or if it is beyond the last
1263
+ /// Panics if `at ` is not on a `UTF-8` code point boundary, or if it is beyond the last
1264
1264
/// code point of the string.
1265
1265
///
1266
1266
/// # Examples
@@ -1275,9 +1275,9 @@ impl String {
1275
1275
/// ```
1276
1276
#[ inline]
1277
1277
#[ stable( feature = "string_split_off" , since = "1.16.0" ) ]
1278
- pub fn split_off ( & mut self , mid : usize ) -> String {
1279
- assert ! ( self . is_char_boundary( mid ) ) ;
1280
- let other = self . vec . split_off ( mid ) ;
1278
+ pub fn split_off ( & mut self , at : usize ) -> String {
1279
+ assert ! ( self . is_char_boundary( at ) ) ;
1280
+ let other = self . vec . split_off ( at ) ;
1281
1281
unsafe { String :: from_utf8_unchecked ( other) }
1282
1282
}
1283
1283
0 commit comments