---
title: "CFNumberFormatterCreateNumberFromString(_:_:_:_:_:)"
framework: Core Foundation
role: symbol
role_heading: Function
path: "corefoundation/cfnumberformattercreatenumberfromstring(_:_:_:_:_:)"
---

# CFNumberFormatterCreateNumberFromString(_:_:_:_:_:)

Returns a number object representing a given string.

## Declaration

```swift
func CFNumberFormatterCreateNumberFromString(_ allocator: CFAllocator!, _ formatter: CFNumberFormatter!, _ string: CFString!, _ rangep: UnsafeMutablePointer<CFRange>!, _ options: CFOptionFlags) -> CFNumber!
```

## Parameters

- `allocator`: The allocator to use to allocate memory for the new object. Pass NULL or doc://com.apple.corefoundation/documentation/CoreFoundation/kCFAllocatorDefault to use the current default allocator.
- `formatter`: The number formatter to use.
- `string`: The string to parse.
- `rangep`: A reference to a range that specifies the substring of string to be parsed. If NULL, the whole string is parsed. On return, contains the range of the actual extent of the parse (may be less than the given range).
- `options`: Specifies various configuration options to change the behavior of the parse. Currently, doc://com.apple.corefoundation/documentation/CoreFoundation/CFNumberFormatterOptionFlags/parseIntegersOnly is the only possible value for this parameter.

## Return Value

Return Value A new number that represents the given string. Returns NULL if there was a problem creating the number. Ownership follows the The Create Rule.

## See Also

### Formatting Values

- [CFNumberFormatterCreateStringWithNumber(_:_:_:)](corefoundation/cfnumberformattercreatestringwithnumber(_:_:_:).md)
- [CFNumberFormatterCreateStringWithValue(_:_:_:_:)](corefoundation/cfnumberformattercreatestringwithvalue(_:_:_:_:).md)
- [CFNumberFormatterGetDecimalInfoForCurrencyCode(_:_:_:)](corefoundation/cfnumberformattergetdecimalinfoforcurrencycode(_:_:_:).md)
- [CFNumberFormatterGetValueFromString(_:_:_:_:_:)](corefoundation/cfnumberformattergetvaluefromstring(_:_:_:_:_:).md)
