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

# CFStringTokenizerGoToTokenAtIndex(_:_:)

Finds a token that includes the character at a given index, and set it as the current token.

```
func CFStringTokenizerGoToTokenAtIndex(_ tokenizer: CFStringTokenizer!, _ index: CFIndex) -> CFStringTokenizerTokenType
```

## Parameters

`tokenizer`

A CFStringTokenizer object.

`index`

The index of a character in the string for `tokenizer`.

## Return Value

The type of the token if the tokenizer succeeded in finding a token and setting it as the current token. Returns `kCFStringTokenizerTokenNone` if the tokenizer failed to find a token. For possible values, see [`CFStringTokenizerTokenType`](/documentation/CoreFoundation/CFStringTokenizerTokenType).

## Discussion

You can obtain the range and attribute of the token calling [`CFStringTokenizerGetCurrentTokenRange(_:)`](/documentation/CoreFoundation/CFStringTokenizerGetCurrentTokenRange(_:)) and [`CFStringTokenizerCopyCurrentTokenAttribute(_:_:)`](/documentation/CoreFoundation/CFStringTokenizerCopyCurrentTokenAttribute(_:_:)). If the token is a compound (with type `kCFStringTokenizerTokenHasSubTokensMask` or `kCFStringTokenizerTokenHasDerivedSubTokensMask`), you can obtain its subtokens and (or) derived subtokens by calling [`CFStringTokenizerGetCurrentSubTokens(_:_:_:_:)`](/documentation/CoreFoundation/CFStringTokenizerGetCurrentSubTokens(_:_:_:_:)).

---

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)