---
title: "CFStringHasPrefix(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfstringhasprefix(_:_:)"
---

# CFStringHasPrefix(_:_:)

Determines if the character data of a string begin with a specified sequence of characters.

## Declaration

```swift
func CFStringHasPrefix(_ theString: CFString!, _ prefix: CFString!) -> Bool
```

## Parameters

- `theString`: The string to search.
- `prefix`: The prefix to search for.

## Return Value

Return Value true if theString begins with prefix, false if otherwise.

## See Also

### Comparing Strings

- [CFStringCompare(_:_:_:)](corefoundation/cfstringcompare(_:_:_:).md)
- [CFStringCompareWithOptions(_:_:_:_:)](corefoundation/cfstringcomparewithoptions(_:_:_:_:).md)
- [CFStringCompareWithOptionsAndLocale(_:_:_:_:_:)](corefoundation/cfstringcomparewithoptionsandlocale(_:_:_:_:_:).md)
- [CFStringHasSuffix(_:_:)](corefoundation/cfstringhassuffix(_:_:).md)
