@@ -668,10 +668,13 @@ impl char {
668
668
/// Basic usage:
669
669
///
670
670
/// ```
671
- /// assert_eq!('C'.to_lowercase().next(), Some('c'));
671
+ /// assert_eq!('C'.to_lowercase().collect::<String>(), "c");
672
+ ///
673
+ /// // Sometimes the result is more than one character:
674
+ /// assert_eq!('İ'.to_lowercase().collect::<String>(), "i\u{307}");
672
675
///
673
676
/// // Japanese scripts do not have case, and so:
674
- /// assert_eq!('山'.to_lowercase().next (), Some('山') );
677
+ /// assert_eq!('山'.to_lowercase().collect::<String> (), "山" );
675
678
/// ```
676
679
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
677
680
#[ inline]
@@ -702,10 +705,13 @@ impl char {
702
705
/// Basic usage:
703
706
///
704
707
/// ```
705
- /// assert_eq!('c'.to_uppercase().next(), Some('C'));
708
+ /// assert_eq!('c'.to_uppercase().collect::<String>(), "C");
709
+ ///
710
+ /// // Sometimes the result is more than one character:
711
+ /// assert_eq!('ß'.to_uppercase().collect::<String>(), "SS");
706
712
///
707
713
/// // Japanese does not have case, and so:
708
- /// assert_eq!('山'.to_uppercase().next (), Some('山') );
714
+ /// assert_eq!('山'.to_uppercase().collect::<String> (), "山" );
709
715
/// ```
710
716
///
711
717
/// In Turkish, the equivalent of 'i' in Latin has five forms instead of two:
@@ -716,17 +722,17 @@ impl char {
716
722
/// Note that the lowercase dotted 'i' is the same as the Latin. Therefore:
717
723
///
718
724
/// ```
719
- /// let upper_i = 'i'.to_uppercase().next ();
725
+ /// let upper_i: String = 'i'.to_uppercase().collect ();
720
726
/// ```
721
727
///
722
728
/// The value of `upper_i` here relies on the language of the text: if we're
723
- /// in `en-US`, it should be `Some('I') `, but if we're in `tr_TR`, it should
724
- /// be `Some('İ') `. `to_uppercase()` does not take this into account, and so:
729
+ /// in `en-US`, it should be `"I" `, but if we're in `tr_TR`, it should
730
+ /// be `"İ" `. `to_uppercase()` does not take this into account, and so:
725
731
///
726
732
/// ```
727
- /// let upper_i = 'i'.to_uppercase().next ();
733
+ /// let upper_i: String = 'i'.to_uppercase().collect ();
728
734
///
729
- /// assert_eq!(Some('I'), upper_i );
735
+ /// assert_eq!(upper_i, "I" );
730
736
/// ```
731
737
///
732
738
/// holds across languages.
0 commit comments