---
title: "CFCharacterSetCreateCopy(_:_:)"
framework: corefoundation
role: symbol
role_heading: Function
path: "corefoundation/cfcharactersetcreatecopy(_:_:)"
---

# CFCharacterSetCreateCopy(_:_:)

Creates a new character set with the values from a given character set.

## Declaration

```swift
func CFCharacterSetCreateCopy(_ alloc: CFAllocator!, _ theSet: CFCharacterSet!) -> CFCharacterSet!
```

## Parameters

- `alloc`: The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.
- `theSet`: The character set to copy.

## Return Value

Return Value A new character set that is a copy of theSet. Ownership follows the The Create Rule.

## Discussion

Discussion This function tries to compact the backing store where applicable.

## See Also

### Creating Character Sets

- [CFCharacterSetCreateInvertedSet(_:_:)](corefoundation/cfcharactersetcreateinvertedset(_:_:).md)
- [CFCharacterSetCreateWithCharactersInRange(_:_:)](corefoundation/cfcharactersetcreatewithcharactersinrange(_:_:).md)
- [CFCharacterSetCreateWithCharactersInString(_:_:)](corefoundation/cfcharactersetcreatewithcharactersinstring(_:_:).md)
- [CFCharacterSetCreateWithBitmapRepresentation(_:_:)](corefoundation/cfcharactersetcreatewithbitmaprepresentation(_:_:).md)
