Share via


EditPoint.ReplaceText – metoda

Daný text nahradí vybraný text.

Obor názvů:  EnvDTE
Sestavení:  EnvDTE (v EnvDTE.dll)

Syntaxe

'Deklarace
Sub ReplaceText ( _
    PointOrCount As Object, _
    Text As String, _
    Flags As Integer _
)
void ReplaceText(
    Object PointOrCount,
    string Text,
    int Flags
)
void ReplaceText(
    [InAttribute] Object^ PointOrCount, 
    [InAttribute] String^ Text, 
    [InAttribute] int Flags
)
abstract ReplaceText : 
        PointOrCount:Object * 
        Text:string * 
        Flags:int -> unit
function ReplaceText(
    PointOrCount : Object, 
    Text : String, 
    Flags : int
)

Parametry

  • PointOrCount
    Typ: Object

    Požadováno.Buď TextPoint objektu nebo celé číslo, které určuje text, který chcete nahradit.

  • Text
    Typ: String

    Požadováno.Text, který chcete vložit.

Poznámky

ReplaceTextnahradí text mezi bodem úpravy a PointOrCount s Text, provedení pokusu správně zachovat umístění značky zarážky, pojmenované zkratky a podobně.

Příklady

Sub ReplaceTextExample()
   Dim objTextDoc As TextDocument
   Dim objMovePt As EditPoint
   Dim objEditPt As EditPoint, iCtr As Integer

   ' Create a new text file.
   DTE.ItemOperations.NewFile("General\Text File")

   ' Get a handle to the new document and create an EditPoint.
   objTextDoc = DTE.ActiveDocument.Object("TextDocument")
   objMovePt = objTextDoc.EndPoint.CreateEditPoint
   objEditPt = objTextDoc.StartPoint.CreateEditPoint

   ' Insert ten lines of text.
   For iCtr = 1 To 10
      objEditPt.Insert("This is a test." & Chr(13))
   Next iCtr
   objEditPt.StartOfDocument()
   objMovePt.EndOfDocument()
   ' Replace all occurrences of "test" with "thing."
   MsgBox("Replacing all text with a new string...")
   objEditPt.ReplaceText(objMovePt, "ALL TEXT REPLACED WITH THIS SENTENCE.", vsEPReplaceTextOptions.vsEPReplaceTextAutoformat)
End Sub

Zabezpečení rozhraní .NET Framework

Viz také

Referenční dokumentace

EditPoint Rozhraní

EnvDTE – obor názvů