<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/Decimal/init(_:format:lenient:)-8t5o2",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:So9NSDecimala10FoundationE_6format7lenientABSS_AbCE11FormatStyleV8CurrencyVSbtKcfc"
  },
  "title" : "init(_:format:lenient:)"
}
-->

# init(_:format:lenient:)

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

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

## Parameters

`value`

A string that contains a formatted decimal value.

`format`

A format style that describes currency formatting conventions used by the string. The initializer uses this format’s [`parseStrategy`](/documentation/Foundation/Decimal/FormatStyle/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

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

---

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)