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

# CFStringTrim(_:_:)

Trims a specified substring from the beginning and end of a CFMutableString object.

```
func CFStringTrim(_ theString: CFMutableString!, _ trimString: CFString!)
```

## Parameters

`theString`

The string to trim. If this value is not a CFMutableString object, an assertion is raised.

`trimString`

The string to trim from `theString`. The characters of the trim string are treated as a substring and not individually; for example, if the mutable characters are “abc X” and the trim string is “XY”, the mutable characters are not affected.

## 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)