<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CFStringCompareFlags/compareAnchored",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@E@CFStringCompareFlags@kCFCompareAnchored"
  },
  "title" : "compareAnchored"
}
-->

# compareAnchored

Performs searching only on characters at the beginning or end of the range.

```
static var compareAnchored: CFStringCompareFlags { get }
```

## Discussion

No match at the beginning or end means nothing is found, even if a matching sequence of characters occurs elsewhere in the string.

---

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)