---
title: "init(_:format:lenient:)"
framework: foundation
role: symbol
role_heading: Initializer
path: "foundation/decimal/init(_:format:lenient:)-6fk71"
---

# init(_:format:lenient:)

Creates and initializes a decimal by parsing a string according to the provided format style.

## Declaration

```swift
init(_ value: String, format: Decimal.FormatStyle, lenient: Bool = true) throws
```

## Parameters

- `value`: A string that contains a formatted decimal value.
- `format`: A format style that describes formatting conventions used by the string. The initializer uses this format’s doc://com.apple.foundation/documentation/Foundation/Decimal/ParseStrategy to parse the string.
- `lenient`: A Boolean value that indicates whether the parse strategy should permit some discrepancies when parsing. Defaults to true.

## Discussion

Discussion This initializer throws an error if the format style fails to parse the string into a decimal value.

## See Also

### Creating a decimal by parsing a string

- [init(_:format:lenient:)](foundation/decimal/init(_:format:lenient:)-8t5o2.md)
- [init(_:format:lenient:)](foundation/decimal/init(_:format:lenient:)-3u6o6.md)
- [init(string:locale:)](foundation/decimal/init(string:locale:).md)
- [init(_:strategy:)](foundation/decimal/init(_:strategy:).md)
- [Decimal.ParseStrategy](foundation/decimal/parsestrategy.md)
