---
title: "init(string:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/nsdecimalnumber/init(string:)"
---

# init(string:)

Initializes a decimal number so that its value is equivalent to that in a given numeric string.

## Declaration

```swift
convenience init(string numberValue: String?)
```

## Parameters

- `numberValue`: A numeric string. Besides digits, numberValue can include an initial + or –; a single E or e, to indicate the exponent of a number in scientific notation; and a single decimal separator character to divide the fractional from the integral part of the number. For a listing of acceptable and unacceptable strings, see doc://com.apple.foundation/documentation/Foundation/NSDecimalNumber/init(string:locale:).

## Discussion

Discussion Don’t use this initializer if numberValue has a fractional part, since the lack of a locale makes handling the decimal separator ambiguous. The separator is a period in some locales (like in the United States) and a comma in others (such as France). To parse a numeric string with a fractional part, use init(string:locale:) instead. When working with numeric representations with a known format, pass a fixed locale to ensure consistent results independent of the user’s current device settings. For localized parsing that uses the user’s current device settings, pass current.

## See Also

### Initializing a Decimal Number

- [init(decimal:)](foundation/nsdecimalnumber/init(decimal:).md)
- [init(mantissa:exponent:isNegative:)](foundation/nsdecimalnumber/init(mantissa:exponent:isnegative:).md)
- [init(string:locale:)](foundation/nsdecimalnumber/init(string:locale:).md)
