Skip to content

Commit f3ca16b

Browse files
Rollup merge of rust-lang#150902 - docs-150888-to_uppercase, r=Noratrieb,workingjubilee
Update to_uppercase docs to avoid ß->SS example Fixes rust-lang#150888 Updates the `to_uppercase` documentation examples to avoid relying on the ß → "SS" mapping and instead uses a stable multi-character case-mapping example ('ffi' → "FFI"). Note: the example uses U+FB03 (LATIN SMALL LIGATURE FFI), not the ASCII string "ffi".
2 parents 634b594 + 6b5a1a5 commit f3ca16b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

library/core/src/char/methods.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,11 +1143,12 @@ impl char {
11431143
/// [Unicode Standard]: https://www.unicode.org/versions/latest/
11441144
///
11451145
/// # Examples
1146+
/// `'ſt'` (U+FB05) is a single Unicode code point (a ligature) that maps to "ST" in uppercase.
11461147
///
11471148
/// As an iterator:
11481149
///
11491150
/// ```
1150-
/// for c in 'ß'.to_uppercase() {
1151+
/// for c in ''.to_uppercase() {
11511152
/// print!("{c}");
11521153
/// }
11531154
/// println!();
@@ -1156,13 +1157,13 @@ impl char {
11561157
/// Using `println!` directly:
11571158
///
11581159
/// ```
1159-
/// println!("{}", 'ß'.to_uppercase());
1160+
/// println!("{}", ''.to_uppercase());
11601161
/// ```
11611162
///
11621163
/// Both are equivalent to:
11631164
///
11641165
/// ```
1165-
/// println!("SS");
1166+
/// println!("ST");
11661167
/// ```
11671168
///
11681169
/// Using [`to_string`](../std/string/trait.ToString.html#tymethod.to_string):
@@ -1171,7 +1172,7 @@ impl char {
11711172
/// assert_eq!('c'.to_uppercase().to_string(), "C");
11721173
///
11731174
/// // Sometimes the result is more than one character:
1174-
/// assert_eq!('ß'.to_uppercase().to_string(), "SS");
1175+
/// assert_eq!(''.to_uppercase().to_string(), "ST");
11751176
///
11761177
/// // Characters that do not have both uppercase and lowercase
11771178
/// // convert into themselves.

0 commit comments

Comments
 (0)