---
title: "decimalSeparator(strategy:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/decimal/formatstyle/decimalseparator(strategy:)"
---

# decimalSeparator(strategy:)

Modifies the format style to use the specified decimal separator display strategy.

## Declaration

```swift
func decimalSeparator(strategy: Decimal.FormatStyle.Configuration.DecimalSeparatorDisplayStrategy) -> Decimal.FormatStyle
```

## Parameters

- `strategy`: The decimal separator display strategy to apply to the format style.

## Return Value

Return Value A decimal format style modified to use the specified decimal separator display strategy.

## Discussion

Discussion The following example creates a default Decimal.FormatStyle for the en_US locale, and a second style that uses the always strategy. It then applies each style to an array of decimal values that don’t have a fractional part. The formatting that the modified style applies adds a trailing decimal separator in all cases. let defaultStyle = Decimal.FormatStyle(locale: Locale(identifier: "en_US")) let alwaysStyle = defaultStyle.decimalSeparator(strategy: .always) let nums: [Decimal] = [100.0, 1000.0, 10000.0, 100000.0, 1000000.0] let defaultNums = nums.map { defaultStyle.format($0) } // ["100", "1,000", "10,000", "100,000", "1,000,000"] let alwaysNums = nums.map { alwaysStyle.format($0) } // ["100.", "1,000.", "10,000.", "100,000.", "1,000,000."]

## See Also

### Customizing style behavior

- [grouping(_:)](foundation/decimal/formatstyle/grouping(_:).md)
- [locale(_:)](foundation/decimal/formatstyle/locale(_:).md)
- [notation(_:)](foundation/decimal/formatstyle/notation(_:).md)
- [precision(_:)](foundation/decimal/formatstyle/precision(_:).md)
- [rounded(rule:increment:)](foundation/decimal/formatstyle/rounded(rule:increment:).md)
- [scale(_:)](foundation/decimal/formatstyle/scale(_:).md)
- [sign(strategy:)](foundation/decimal/formatstyle/sign(strategy:).md)
- [Decimal.FormatStyle.Configuration](foundation/decimal/formatstyle/configuration.md)
- [NumberFormatStyleConfiguration](foundation/numberformatstyleconfiguration.md)
