---
title: "hasPrefix(_:)"
framework: swift
role: symbol
role_heading: Instance Method
path: "swift/stringprotocol/hasprefix(_:)"
---

# hasPrefix(_:)

## Declaration

```swift
func hasPrefix(_ prefix: String) -> Bool
```
