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

# CFStringGetPascalString(_:_:_:_:)

Copies the character contents of a CFString object to a local Pascal string buffer after converting the characters to a requested encoding.

```
func CFStringGetPascalString(_ theString: CFString!, _ buffer: StringPtr!, _ bufferSize: CFIndex, _ encoding: CFStringEncoding) -> Bool
```

## Parameters

`theString`

The string to examine.

`buffer`

The Pascal string buffer into which to copy the `theString`. The buffer must be at least `bufferSize` bytes in length. On return, contains the converted characters. If there is an error in conversion, the buffer contains only partial results.

`bufferSize`

The length of the local `buffer` in bytes (accounting for the length byte).

`encoding`

The string encoding to which the character contents of `theString` should be converted.

## Return Value

`true` if the operation succeeds or `false` if the conversion fails or the provided buffer is too small.

## Discussion

This function is useful when you need your own copy of a CFString object’s character data as a Pascal string. You can also call it as a “backup” operation when a prior call to the [`CFStringGetPascalStringPtr(_:_:)`](/documentation/CoreFoundation/CFStringGetPascalStringPtr(_:_:)) function fails.

---

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)