File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -330,7 +330,7 @@ impl str {
330
330
/// ```
331
331
/// let mut v = String::from("🗻∈🌏");
332
332
///
333
- /// assert_eq!(Some("🗻"), v.get(0..4);
333
+ /// assert_eq!(Some("🗻"), v.get(0..4)) ;
334
334
///
335
335
/// // indices not on UTF-8 sequence boundaries
336
336
/// assert!(v.get_mut(1..).is_none());
@@ -573,12 +573,16 @@ impl str {
573
573
/// Basic usage:
574
574
///
575
575
/// ```
576
- /// let mut s = "Per Martin-Löf".to_string();
577
- ///
578
- /// let (first, last) = s.split_at_mut(3);
576
+ /// use std::ascii::AsciiExt;
579
577
///
580
- /// assert_eq!("Per", first);
581
- /// assert_eq!(" Martin-Löf", last);
578
+ /// let mut s = "Per Martin-Löf".to_string();
579
+ /// {
580
+ /// let (first, last) = s.split_at_mut(3);
581
+ /// first.make_ascii_uppercase();
582
+ /// assert_eq!("PER", first);
583
+ /// assert_eq!(" Martin-Löf", last);
584
+ /// }
585
+ /// assert_eq!("PER Martin-Löf", s);
582
586
/// ```
583
587
#[ inline]
584
588
#[ stable( feature = "str_split_at" , since = "1.4.0" ) ]
You can’t perform that action at this time.
0 commit comments