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

# hasPrefix(_:)

## Declaration

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

## See Also

### Finding Substrings

- [hasSuffix(_:)](swift/string/hassuffix(_:).md)
