diff options
| author | William Throwe <wtt6@cornell.edu> | 2015-11-01 00:32:52 -0400 |
|---|---|---|
| committer | William Throwe <wtt6@cornell.edu> | 2015-12-07 22:29:25 -0500 |
| commit | 34fe201c1a6370a945398fda58c192cd4921afb0 (patch) | |
| tree | 7a96f95c7c5e2db99f5e3a7e0ceaee5eab0e03e9 | |
| parent | e7f3d6eddd28a917c9a0f7cd73a489048ca7f4cd (diff) | |
| download | rust-34fe201c1a6370a945398fda58c192cd4921afb0.tar.gz rust-34fe201c1a6370a945398fda58c192cd4921afb0.zip | |
Fix some str docs to refer to patterns
| -rw-r--r-- | src/libcollections/str.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 989637517b0..be2542dbdca 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -857,9 +857,10 @@ impl str { Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) } } - /// Returns `true` if the given `&str` is a sub-slice of this string slice. + /// Returns `true` if the given pattern matches a sub-slice of + /// this string slice. /// - /// Returns `false` if it's not. + /// Returns `false` if it does not. /// /// # Examples /// @@ -876,9 +877,10 @@ impl str { core_str::StrExt::contains(self, pat) } - /// Returns `true` if the given `&str` is a prefix of this string slice. + /// Returns `true` if the given pattern matches a prefix of this + /// string slice. /// - /// Returns `false` if it's not. + /// Returns `false` if it does not. /// /// # Examples /// @@ -895,9 +897,10 @@ impl str { core_str::StrExt::starts_with(self, pat) } - /// Returns `true` if the given `&str` is a suffix of this string slice. + /// Returns `true` if the given pattern matches a suffix of this + /// string slice. /// - /// Returns `false` if not. + /// Returns `false` if it does not. /// /// # Examples /// @@ -1681,11 +1684,11 @@ impl str { core_str::StrExt::parse(self) } - /// Replaces all occurrences of one string with another. + /// Replaces all matches of a pattern with another string. /// /// `replace` creates a new [`String`], and copies the data from this string slice into it. - /// While doing so, it attempts to find a sub-`&str`. If it finds it, it replaces it with - /// the replacement string slice. + /// While doing so, it attempts to find matches of a pattern. If it finds any, it + /// replaces them with the replacement string slice. /// /// [`String`]: string/struct.String.html /// @@ -1699,7 +1702,7 @@ impl str { /// assert_eq!("this is new", s.replace("old", "new")); /// ``` /// - /// When a `&str` isn't found: + /// When the pattern doesn't match: /// /// ``` /// let s = "this is old"; |
