Skip to content

Commit

Permalink
Auto merge of #61677 - napen123:string-examples, r=sfackler
Browse files Browse the repository at this point in the history
Add examples for make_ascii_{uppercase, lowercase}

As the title says, this adds simple usage examples for make_ascii_uppercase and make_ascii_lowercase.
  • Loading branch information
bors committed Jun 9, 2019
2 parents e6e60ef + 1b6b759 commit 07c3967
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() };
Expand All @@ -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() };
Expand Down

0 comments on commit 07c3967

Please sign in to comment.