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

# CFStringInsert(_:_:_:)

Inserts a string at a specified location in the character buffer of a CFMutableString object.

```
func CFStringInsert(_ str: CFMutableString!, _ idx: CFIndex, _ insertedStr: CFString!)
```

## Parameters

`str`

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

`idx`

The index of the character in `str` after which the new characters are to be inserted. If the index is out of bounds, an assertion is raised.

`insertedStr`

The string to insert into `str`.

## Discussion

To accommodate the new characters, this function moves any existing characters to the right of the inserted characters the appropriate number of positions.

---

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)