@@ -2249,6 +2249,67 @@ impl str {
22492249 let me = unsafe { self . as_bytes_mut ( ) } ;
22502250 me. make_ascii_lowercase ( )
22512251 }
2252+
2253+ /// Splits the string slice into two at the given index.
2254+ ///
2255+ /// Returns a new string slice. `self` contains bytes `[at, len)`, and
2256+ /// the returned string slice contains bytes `[at, len)`. `at` must be on
2257+ /// the boundary of a UTF-8 code point.
2258+ ///
2259+ /// # Panics
2260+ ///
2261+ /// Panics if `at` is not on a `UTF-8` code point boundary, or if it is
2262+ /// beyond the last code point of the string.
2263+ ///
2264+ /// # Examples
2265+ ///
2266+ /// ```
2267+ /// #![feature(slice_split_off)]
2268+ ///
2269+ /// let mut best_baguette = "baguette de tradition";
2270+ /// let why_best = best_baguette.split_off(9);
2271+ /// assert_eq!(best_baguette, "baguette ");
2272+ /// assert_eq!(why_best, "de tradition");
2273+ /// ```
2274+ #[ unstable( feature = "slice_split_off" , issue = "0" ) ]
2275+ #[ inline]
2276+ pub fn split_off < ' a > ( self : & mut & ' a Self , at : usize ) -> & ' a str {
2277+ core_str:: StrExt :: split_off ( self , at)
2278+ }
2279+
2280+ /// Splits the mutable string slice into two at the given index.
2281+ ///
2282+ /// Returns a new mutable string slice. `self` contains bytes `[0, at)`, and
2283+ /// the returned string slice contains bytes `[at, len)`. `at` must be on
2284+ /// the boundary of a UTF-8 code point.
2285+ ///
2286+ /// To split immutable string slices instead, see the [`split_off`] method.
2287+ ///
2288+ /// [`split_off`]: #method.split_off
2289+ ///
2290+ /// # Panics
2291+ ///
2292+ /// Panics if `at` is not on a UTF-8 code point boundary, or if it is
2293+ /// beyond the last code point of the string slice.
2294+ ///
2295+ /// # Examples
2296+ ///
2297+ /// Basic usage:
2298+ ///
2299+ /// ```
2300+ /// #![feature(slice_split_off)]
2301+ ///
2302+ /// let mut magritte_says = &mut *String::from("Ceci n'est pas une pipe.");
2303+ /// let it_is_not = magritte_says.split_off_mut(19);
2304+ /// it_is_not.make_ascii_uppercase();
2305+ /// assert_eq!(magritte_says, "Ceci n'est pas une ");
2306+ /// assert_eq!(it_is_not, "PIPE.");
2307+ /// ```
2308+ #[ unstable( feature = "slice_split_off" , issue = "0" ) ]
2309+ #[ inline]
2310+ pub fn split_off_mut < ' a > ( self : & mut & ' a mut Self , at : usize ) -> & ' a mut str {
2311+ core_str:: StrExt :: split_off_mut ( self , at)
2312+ }
22522313}
22532314
22542315/// Converts a boxed slice of bytes to a boxed string slice without checking
0 commit comments