@@ -857,9 +857,10 @@ impl str {
857
857
Utf16Units { encoder : Utf16Encoder :: new ( self [ ..] . chars ( ) ) }
858
858
}
859
859
860
- /// Returns `true` if the given `&str` is a sub-slice of this string slice.
860
+ /// Returns `true` if the given pattern matches a sub-slice of
861
+ /// this string slice.
861
862
///
862
- /// Returns `false` if it's not.
863
+ /// Returns `false` if it does not.
863
864
///
864
865
/// # Examples
865
866
///
@@ -876,9 +877,10 @@ impl str {
876
877
core_str:: StrExt :: contains ( self , pat)
877
878
}
878
879
879
- /// Returns `true` if the given `&str` is a prefix of this string slice.
880
+ /// Returns `true` if the given pattern matches a prefix of this
881
+ /// string slice.
880
882
///
881
- /// Returns `false` if it's not.
883
+ /// Returns `false` if it does not.
882
884
///
883
885
/// # Examples
884
886
///
@@ -895,9 +897,10 @@ impl str {
895
897
core_str:: StrExt :: starts_with ( self , pat)
896
898
}
897
899
898
- /// Returns `true` if the given `&str` is a suffix of this string slice.
900
+ /// Returns `true` if the given pattern matches a suffix of this
901
+ /// string slice.
899
902
///
900
- /// Returns `false` if not.
903
+ /// Returns `false` if it does not.
901
904
///
902
905
/// # Examples
903
906
///
@@ -1681,11 +1684,11 @@ impl str {
1681
1684
core_str:: StrExt :: parse ( self )
1682
1685
}
1683
1686
1684
- /// Replaces all occurrences of one string with another.
1687
+ /// Replaces all matches of a pattern with another string .
1685
1688
///
1686
1689
/// `replace` creates a new [`String`], and copies the data from this string slice into it.
1687
- /// While doing so, it attempts to find a sub-`&str` . If it finds it , it replaces it with
1688
- /// the replacement string slice.
1690
+ /// While doing so, it attempts to find matches of a pattern . If it finds any , it
1691
+ /// replaces them with the replacement string slice.
1689
1692
///
1690
1693
/// [`String`]: string/struct.String.html
1691
1694
///
@@ -1699,7 +1702,7 @@ impl str {
1699
1702
/// assert_eq!("this is new", s.replace("old", "new"));
1700
1703
/// ```
1701
1704
///
1702
- /// When a `&str` isn 't found :
1705
+ /// When the pattern doesn 't match :
1703
1706
///
1704
1707
/// ```
1705
1708
/// let s = "this is old";
0 commit comments