File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -719,13 +719,17 @@ impl str {
719
719
/// Remember, [`char`]s may not match your human intuition about characters:
720
720
///
721
721
/// ```
722
- /// let y = "y̆ ";
722
+ /// let yes = "y̆es ";
723
723
///
724
- /// let mut char_indices = y .char_indices();
724
+ /// let mut char_indices = yes .char_indices();
725
725
///
726
726
/// assert_eq!(Some((0, 'y')), char_indices.next()); // not (0, 'y̆')
727
727
/// assert_eq!(Some((1, '\u{0306}')), char_indices.next());
728
728
///
729
+ /// // note the 3 here - the last character took up two bytes
730
+ /// assert_eq!(Some((3, 'e')), char_indices.next());
731
+ /// assert_eq!(Some((4, 's')), char_indices.next());
732
+ ///
729
733
/// assert_eq!(None, char_indices.next());
730
734
/// ```
731
735
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
You can’t perform that action at this time.
0 commit comments