Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

Excerpt

Replaces this match with the specified string.

Signature
C#C#
Wiki Markup
{description}
{excerpt}Replaces this match with the specified string.{excerpt}
{signature:C#}
 public void Replace(System.String replaceWith)
Signature
{signature}{signature:vb.net
vb.net
}
Public Sub Replace(ByVal replaceWith As String)
Parameters
{signature}
{parameters}
{param:replaceWith}The replacement string.{param}
{example}{code:csharp|title=C#}

          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\somedoc.doc");
          IEnumerator searcherator = doc.Search("crimson");
          while (searcherator.MoveNext())
          {
               SearchMatch match = (SearchMatch)searcherator.Current;
               match.Replace("red");
          }
        
{code}
{code:vb.net
|title=vb.net
}

          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\somedoc.doc")
          Dim searcherator As IEnumerator = doc.Search("crimson")
          While searcherator.MoveNext()
               Dim match As SearchMatch = searcherator.Current
               match.Replace("red")
          End While
        {code}

{example}
Param
replaceWithreplaceWith

The replacement string.

Example
Code Block
csharpcsharp
titleC#
Code Block
vb.nettitle