# <replacestring>

Replaces all occurrences of a given string in the original input with user-supplied replacement string.

This filter replaces all occurrences of a given string in the original input stream with a user-supplied replacement string. By default string comparisons are case sensitive but this can be changed by setting the optional `ignorecase` attribute to true.

To use this filter specify the string to be replaced with the `from` attribute and the string to replace it with using the `to` attribute.

Filters are intended to be used as a element of a <filterchain>.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
from | string | The string to be replaced. | True
ignorecase | bool | Determines if case will be ignored. The default is false. | False
to | string | The new value for the replaced string. Am empty string is permissible. | False
if | bool | If true then the filter will be used; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the filter will be executed; otherwise, skipped. The default is false. | False

### Examples

- Replace all occurrences of "3.14" with "PI".

      <replacestring from="3.14" to="PI" />

- Replace all occurrences of "string", "String", etc. with "System.String".

      <replacestring from="String" to="System.String" ignorecase="true" />

### Requirements

Assembly: NAnt.Core (0.90.3780.0)