<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFStringHasPrefix(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFStringHasPrefix"
  },
  "title" : "CFStringHasPrefix(_:_:)"
}
-->

# CFStringHasPrefix(_:_:)

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

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

## Parameters

`theString`

The string to search.

`prefix`

The prefix to search for.

## Return Value

`true` if `theString` begins with `prefix`, `false` if otherwise.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)