Contents

starts(with:)

Returns whether other is a prefix of self, only considering whole path components.

Declaration

func starts(with other: FilePath) -> Bool

Discussion

Example:

let path: FilePath = "/usr/bin/ls"
path.starts(with: "/")              // true
path.starts(with: "/usr/bin")       // true
path.starts(with: "/usr/bin/ls")    // true
path.starts(with: "/usr/bin/ls///") // true
path.starts(with: "/us")            // false