We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 03b4ea4 commit 8b2e79dCopy full SHA for 8b2e79d
library/core/src/slice/mod.rs
@@ -1783,6 +1783,10 @@ impl<T> [T] {
1783
/// assert_eq!(v.strip_prefix(&[10, 40]), Some(&[30][..]));
1784
/// assert_eq!(v.strip_prefix(&[50]), None);
1785
/// assert_eq!(v.strip_prefix(&[10, 50]), None);
1786
+ ///
1787
+ /// let prefix : &str = "he";
1788
+ /// assert_eq!(b"hello".strip_prefix(prefix.as_bytes()),
1789
+ /// Some(b"llo".as_ref()));
1790
/// ```
1791
#[must_use = "returns the subslice without modifying the original"]
1792
#[stable(feature = "slice_strip", since = "1.50.0")]
0 commit comments