---
title: "shouldReplaceCharacters(inRanges:with:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextfinderclient/shouldreplacecharacters(inranges:with:)"
---

# shouldReplaceCharacters(inRanges:with:)

Returns whether the specified strings should be replaced.

## Declaration

```swift
optional func shouldReplaceCharacters(inRanges ranges: [NSValue], with strings: [String]) -> Bool
```

## Parameters

- `ranges`: The ranges of the strings to replace.
- `strings`: The replacement strings.

## Return Value

Return Value Returns true if the replacement should occur; otherwise false.

## Discussion

Discussion See NSTextFinder for a complete description.

## See Also

### Replacing Text

- [replaceCharacters(in:with:)](appkit/nstextfinderclient/replacecharacters(in:with:).md)
- [didReplaceCharacters()](appkit/nstextfinderclient/didreplacecharacters().md)
