---
title: rangeOfPassword
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlcomponents/rangeofpassword
---

# rangeOfPassword

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

## Declaration

```swift
var rangeOfPassword: 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)
- [rangeOfPath](foundation/urlcomponents/rangeofpath.md)
- [rangeOfPort](foundation/urlcomponents/rangeofport.md)
- [rangeOfQuery](foundation/urlcomponents/rangeofquery.md)
- [rangeOfScheme](foundation/urlcomponents/rangeofscheme.md)
- [rangeOfUser](foundation/urlcomponents/rangeofuser.md)
