---
title: applyReplacementIndexAttribute
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/attributedstring/formattingoptions/applyreplacementindexattribute
---

# applyReplacementIndexAttribute

An option to add an attribute that marks replacements in localized strings.

## Declaration

```swift
static let applyReplacementIndexAttribute: AttributedString.FormattingOptions
```

## Discussion

Discussion When you use this option, string formatting applies the replacementIndex key to the final range of each replacement. Its value is an Int, wrapping the integer ordinal of that particular replacement, such as the 2 in %2$@. This allows the developer to relate ranges to replacements even if a localizer modifies the word order.
