---
title: "CFStringTokenizerAdvanceToNextToken(_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfstringtokenizeradvancetonexttoken(_:)"
---

# CFStringTokenizerAdvanceToNextToken(_:)

Advances the tokenizer to the next token and sets that as the current token.

## Declaration

```swift
func CFStringTokenizerAdvanceToNextToken(_ tokenizer: CFStringTokenizer!) -> CFStringTokenizerTokenType
```

## Parameters

- `tokenizer`: A CFStringTokenizer object.

## Return Value

Return Value The type of the token if the tokenizer succeeded in finding a token and setting it as current token. Returns kCFStringTokenizerTokenNone if the tokenizer failed to find a token. For possible values, see CFStringTokenizerTokenType.

## Discussion

Discussion If there is no preceding call to CFStringTokenizerGoToTokenAtIndex(_:_:) or CFStringTokenizerAdvanceToNextToken(_:), the function finds the first token in the range specified by the CFStringTokenizerCreate(_:_:_:_:_:). If there is a preceding, successful, call to CFStringTokenizerGoToTokenAtIndex(_:_:) or CFStringTokenizerAdvanceToNextToken(_:) and there is a current token, proceeds to the next token. If a token is found, it is set as the current token and the function returns true; otherwise the current token is invalidated and the function returns false. 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

- [CFStringTokenizerGoToTokenAtIndex(_:_:)](corefoundation/cfstringtokenizergototokenatindex(_:_:).md)
