---
title: replacementIndex
framework: foundation
role: symbol
role_heading: Type Property
path: foundation/nsattributedstring/key/replacementindex
---

# replacementIndex

The replacement position associated with a format string specifier.

## Declaration

```swift
static let replacementIndex: NSAttributedString.Key
```

## Discussion

Discussion When creating an attributed string from a format string and one or more replacement values, this attribute indicates the ordinal index of each replacement. You must specify the NSAttributedStringFormattingApplyReplacementIndexAttribute option at creation time to add this attribute to the substituted text. The value of this key is an NSNumber with the replacement position of the substitute text.

## See Also

### Getting text attribute keys

- [cursor](foundation/nsattributedstring/key/cursor.md)
- [link](foundation/nsattributedstring/key/link.md)
- [markedClauseSegment](foundation/nsattributedstring/key/markedclausesegment.md)
- [shadow](foundation/nsattributedstring/key/shadow.md)
- [spellingState](foundation/nsattributedstring/key/spellingstate.md)
- [suggestionHighlight](foundation/nsattributedstring/key/suggestionhighlight.md)
- [textAlternatives](foundation/nsattributedstring/key/textalternatives.md)
- [textEffect](foundation/nsattributedstring/key/texteffect.md)
- [textHighlightColorScheme](foundation/nsattributedstring/key/texthighlightcolorscheme.md)
- [textHighlightStyle](foundation/nsattributedstring/key/texthighlightstyle.md)
- [textItemTag](foundation/nsattributedstring/key/textitemtag.md)
- [toolTip](foundation/nsattributedstring/key/tooltip.md)
