NAnt SDK Documentation - v0.92

ReplaceString Class

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

For a list of all members of this type, see ReplaceString Members.

System.Object
   NAnt.Core.Element
      NAnt.Core.Filters.ChainableReader
         NAnt.Core.Filters.Filter
            NAnt.Core.Filters.ReplaceString

[Visual Basic]
<ElementName(Name:="replacestring")>
Public Class ReplaceString
    Inherits Filter
[C#]
[ElementName(Name="replacestring")]
public class ReplaceString : Filter

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

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.

Example

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

Namespace: NAnt.Core.Filters

Assembly: NAnt.Core (in NAnt.Core.dll)

See Also

ReplaceString Members | NAnt.Core.Filters Namespace