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

# CFStringFold(_:_:_:)

Folds a given string into the form specified by optional flags.

```
func CFStringFold(_ theString: CFMutableString!, _ theFlags: CFStringCompareFlags, _ theLocale: CFLocale!)
```

## Parameters

`theString`

The string which is to be folded.  If this parameter is not a valid mutable CFString, the behavior is undefined.

`theFlags`

The equivalency flags which describes the character folding form. See “String Comparison Flags” in [`CFString`](/documentation/CoreFoundation/CFString) for possible values. Only those flags containing the word “insensitive” are recognized; other flags are ignored.

    Folding with     `kCFCompareCaseInsensitive`     removes case distinctions in accordance with the mapping specified by     <ftp://ftp.unicode.org/Public/UNIDATA/CaseFolding.txt>    .  Folding with     `kCFCompareDiacriticInsensitive`     removes distinctions of accents and other diacritics.  Folding with     `kCFCompareWidthInsensitive`     removes character width distinctions by mapping characters in the range     `U+FF00-U+FFEF`     to their ordinary equivalents.

`theLocale`

The locale to use for the operation. `NULL` specifies the canonical locale (the return value from [`CFLocaleGetSystem()`](/documentation/CoreFoundation/CFLocaleGetSystem())).

    The locale argument affects the case mapping algorithm. For example, for the Turkish locale, case-insensitive compare matches “I” to “ı” (Unicode code point U+0131, Latin Small Dotless I), not the normal “i” character.

## Discussion

Character foldings are operations that convert any of a set of characters sharing similar semantics into a single representative from that set.

You can use this function to preprocess strings that are to be compared, searched, or indexed. Note that folding does not include normalization, so you must use [`CFStringNormalize(_:_:)`](/documentation/CoreFoundation/CFStringNormalize(_:_:)) in addition to CFStringFold in order to obtain the effect of `kCFCompareNonliteral`.

---

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)