<!--
{
  "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/CFStringTokenizerCreate(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Foundation"
    ],
    "preciseIdentifier" : "c:@F@CFStringTokenizerCreate"
  },
  "title" : "CFStringTokenizerCreate(_:_:_:_:_:)"
}
-->

# CFStringTokenizerCreate(_:_:_:_:_:)

Returns a tokenizer for a given string.

```
func CFStringTokenizerCreate(_ alloc: CFAllocator!, _ string: CFString!, _ range: CFRange, _ options: CFOptionFlags, _ locale: CFLocale!) -> CFStringTokenizer!
```

## Parameters

`alloc`

The allocator to use to allocate memory for the new object. Pass `NULL` or [`kCFAllocatorDefault`](/documentation/CoreFoundation/kCFAllocatorDefault) to use the current default allocator.

`string`

The string to tokenize.

`range`

The range of the characters in `string` to tokenize.

`options`

A tokenization unit option that specifies how `string` should be tokenized. The options can be modified by adding unit modifier options to tell the tokenizer to prepare specified attributes when it tokenizes `string`.
For possible values, see [Tokenization Modifiers](/documentation/CoreFoundation/1588024-tokenization-modifiers).

`locale`

A locale that specifies language- or region-specific behavior for the tokenization. You can pass `NULL` to use the default system locale, although this is typically not recommended—instead use [`CFLocaleCopyCurrent()`](/documentation/CoreFoundation/CFLocaleCopyCurrent()) to specify the locale of the current user.
For more information, see [Tokenization Modifiers](/documentation/CoreFoundation/1588024-tokenization-modifiers).

## Return Value

A tokenizer to analyze the range `range` of `string` for the given locale and options. Ownership follows the [The Create Rule](https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-103029).

## Discussion

---

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)