@@ -1250,17 +1250,17 @@ impl String {
12501250 self . len ( ) == 0
12511251 }
12521252
1253- /// Divide one string into two at an index.
1253+ /// Splits the string into two at the given index.
12541254 ///
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.
12571258 ///
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.
12601260 ///
12611261 /// # Panics
12621262 ///
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
12641264 /// code point of the string.
12651265 ///
12661266 /// # Examples
@@ -1275,9 +1275,9 @@ impl String {
12751275 /// ```
12761276 #[ inline]
12771277 #[ 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 ) ;
12811281 unsafe { String :: from_utf8_unchecked ( other) }
12821282 }
12831283
0 commit comments