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

# CFStringGetCharacterAtIndex(_:_:)

Returns the Unicode character at a specified location in a string.

```
func CFStringGetCharacterAtIndex(_ theString: CFString!, _ idx: CFIndex) -> UniChar
```

## Parameters

`theString`

The string from which the Unicode character is obtained.

`idx`

The position of the Unicode character in the CFString.

## Return Value

A Unicode character.

## Discussion

This function is typically called in a loop to fetch the Unicode characters of a string in sequence or to fetch a character at a known position (first or last, for example). Using it in a loop can be inefficient, especially with longer strings, so consider the [`CFStringGetCharacters(_:_:_:)`](/documentation/CoreFoundation/CFStringGetCharacters(_:_:_:)) function or the in-line buffer functions ([`CFStringInitInlineBuffer(_:_:_:)`](/documentation/CoreFoundation/CFStringInitInlineBuffer(_:_:_:)) and [`CFStringGetCharacterFromInlineBuffer(_:_:)`](/documentation/CoreFoundation/CFStringGetCharacterFromInlineBuffer(_:_:))) as alternatives.

---

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)