---
title: "ends(with:)"
framework: system
role: symbol
role_heading: Instance Method
path: "system/filepath/ends(with:)"
---

# ends(with:)

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

## Declaration

```swift
func ends(with other: FilePath) -> Bool
```

## Discussion

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
