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

# CFStringTrimWhitespace(_:)

Trims whitespace from the beginning and end of a CFMutableString object.

```
func CFStringTrimWhitespace(_ theString: CFMutableString!)
```

## Parameters

`theString`

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

## Discussion

Whitespace for this function includes space characters, tabs, newlines, carriage returns, and any similar characters that do not have a visible representation.

---

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)