---
title: "CFStringTokenizerGoToTokenAtIndex(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfstringtokenizergototokenatindex(_:_:)"
---

# CFStringTokenizerGoToTokenAtIndex(_:_:)

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

## Declaration

```swift
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

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.

## Discussion

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

## See Also

### Changing the Location

- [CFStringTokenizerAdvanceToNextToken(_:)](corefoundation/cfstringtokenizeradvancetonexttoken(_:).md)
