about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNapen123 <napen123@gmail.com>2019-06-08 18:28:29 -0600
committerNapen123 <napen123@gmail.com>2019-06-08 18:28:29 -0600
commit1b6b7597ed96815d9944f8c77eaffb18daece20c (patch)
tree01afb5bb79d7d405bac9dc434769b2febcd18048
parent991c719a1d0f95c37ed7ea56bdb38bcc2a6246b9 (diff)
downloadrust-1b6b7597ed96815d9944f8c77eaffb18daece20c.tar.gz
rust-1b6b7597ed96815d9944f8c77eaffb18daece20c.zip
Add examples for make_ascii_{uppercase, lowercase}
-rw-r--r--src/libcore/str/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index ef4bd83cbc5..8a128b0d5e7 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -3971,6 +3971,16 @@ impl str {
     /// [`to_ascii_uppercase`].
     ///
     /// [`to_ascii_uppercase`]: #method.to_ascii_uppercase
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let mut s = String::from("Grüße, Jürgen ❤");
+    ///
+    /// s.make_ascii_uppercase();
+    ///
+    /// assert_eq!("GRüßE, JüRGEN ❤", s);
+    /// ```
     #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
     pub fn make_ascii_uppercase(&mut self) {
         let me = unsafe { self.as_bytes_mut() };
@@ -3986,6 +3996,16 @@ impl str {
     /// [`to_ascii_lowercase`].
     ///
     /// [`to_ascii_lowercase`]: #method.to_ascii_lowercase
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// let mut s = String::from("Grüße, Jürgen ❤");
+    ///
+    /// s.make_ascii_lowercase();
+    ///
+    /// assert_eq!("grüße, jürgen ❤", s);
+    /// ```
     #[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
     pub fn make_ascii_lowercase(&mut self) {
         let me = unsafe { self.as_bytes_mut() };