---
title: "enumerateTokensInRange:usingBlock:"
framework: naturallanguage
role: symbol
role_heading: Instance Method
path: "naturallanguage/nltokenizer/enumeratetokensinrange:usingblock:"
---

# enumerateTokensInRange:usingBlock:

Enumerates over a given range of the string and calls the specified block for each token.

## Declaration

```occ
- (void) enumerateTokensInRange:(NSRange) range usingBlock:(void (^)(NSRange tokenRange, NLTokenizerAttributes flags, BOOL *stop)) block;
```

## Parameters

- `range`: The range of the string to tokenize.
- `block`: The closure to call after each token; return false if processing should stop.

## Mentioned in

Tokenizing natural language text

## See Also

### Enumerating the tokens

- [tokensForRange:](naturallanguage/nltokenizer/tokensforrange:.md)
- [tokenRangeAtIndex:](naturallanguage/nltokenizer/tokenrangeatindex:.md)
- [tokenRangeForRange:](naturallanguage/nltokenizer/tokenrangeforrange:.md)
