Contents

ends(with:)

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

Declaration

func ends(with other: FilePath) -> Bool

Discussion

Example:

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