---
title: rangeOfPath
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlcomponents/rangeofpath
---

# rangeOfPath

Returns the character range of the path in the string returned by the string property.

## Declaration

```swift
var rangeOfPath: Range<String.Index>? { get }
```

## Discussion

Discussion If the component does not exist, nil is returned. note: Zero length components are legal. For example, the URL string “scheme://:@/?#” has a zero length user, password, host, query and fragment; the URL strings “scheme:” and “” both have a zero length path.

## See Also

### Locating components in the URL string representation

- [rangeOfFragment](foundation/urlcomponents/rangeoffragment.md)
- [rangeOfHost](foundation/urlcomponents/rangeofhost.md)
- [rangeOfPassword](foundation/urlcomponents/rangeofpassword.md)
- [rangeOfPort](foundation/urlcomponents/rangeofport.md)
- [rangeOfQuery](foundation/urlcomponents/rangeofquery.md)
- [rangeOfScheme](foundation/urlcomponents/rangeofscheme.md)
- [rangeOfUser](foundation/urlcomponents/rangeofuser.md)
