We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 62e5488 + 4b549fa commit df2da46Copy full SHA for df2da46
library/std/src/path.rs
@@ -2031,9 +2031,13 @@ impl Path {
2031
/// assert!(path.starts_with("/etc"));
2032
/// assert!(path.starts_with("/etc/"));
2033
/// assert!(path.starts_with("/etc/passwd"));
2034
- /// assert!(path.starts_with("/etc/passwd/"));
+ /// assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
2035
+ /// assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
2036
///
2037
/// assert!(!path.starts_with("/e"));
2038
+ /// assert!(!path.starts_with("/etc/passwd.txt"));
2039
+ ///
2040
+ /// assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
2041
/// ```
2042
#[stable(feature = "rust1", since = "1.0.0")]
2043
pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
0 commit comments