---
title: "sign(strategy:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/integerformatstyle/sign(strategy:)"
---

# sign(strategy:)

Modifies the format style to use the specified sign display strategy for displaying or omitting sign symbols.

## Declaration

```swift
func sign(strategy: IntegerFormatStyle<Value>.Configuration.SignDisplayStrategy) -> IntegerFormatStyle<Value>
```

## Parameters

- `strategy`: The sign display strategy to apply to the format style, such as doc://com.apple.foundation/documentation/Foundation/NumberFormatStyleConfiguration/SignDisplayStrategy/automatic or doc://com.apple.foundation/documentation/Foundation/NumberFormatStyleConfiguration/SignDisplayStrategy/never.

## Return Value

Return Value An integer format style modified to use the specified sign display strategy.

## Discussion

Discussion The following example creates a default IntegerFormatStyle for the en_US locale, and a second style that displays a sign for all values except zero. It then applies each style to an array of integers. The formatting that the modified style applies adds the negative (-) or positive (+) sign to all the numbers. let defaultStyle = IntegerFormatStyle<Int>(locale: Locale(identifier: "en_US")) let alwaysStyle = defaultStyle.sign(strategy: .always(includingZero: false)) let nums = [-2, -1, 0, 1, 2] let defaultNums = nums.map { defaultStyle.format($0) } // ["-2", "-1", "0", "1", "2"] let alwaysNums = nums.map { alwaysStyle.format($0) } // ["-2", "-1", "0", "+1", "+2"]

## See Also

### Customizing style behavior

- [decimalSeparator(strategy:)](foundation/integerformatstyle/decimalseparator(strategy:).md)
- [grouping(_:)](foundation/integerformatstyle/grouping(_:).md)
- [notation(_:)](foundation/integerformatstyle/notation(_:).md)
- [precision(_:)](foundation/integerformatstyle/precision(_:).md)
- [rounded(rule:increment:)](foundation/integerformatstyle/rounded(rule:increment:).md)
- [scale(_:)](foundation/integerformatstyle/scale(_:).md)
- [IntegerFormatStyle.Configuration](foundation/integerformatstyle/configuration.md)
- [NumberFormatStyleConfiguration](foundation/numberformatstyleconfiguration.md)
