共用方式為


IEditorOperations.ReplaceAllMatches 方法

取代所有出現的指定字串。

命名空間:  Microsoft.VisualStudio.Text.Operations
組件:  Microsoft.VisualStudio.Text.UI (在 Microsoft.VisualStudio.Text.UI.dll 中)

語法

'宣告
Function ReplaceAllMatches ( _
    searchText As String, _
    replaceText As String, _
    matchCase As Boolean, _
    matchWholeWord As Boolean, _
    useRegularExpressions As Boolean _
) As Integer
int ReplaceAllMatches(
    string searchText,
    string replaceText,
    bool matchCase,
    bool matchWholeWord,
    bool useRegularExpressions
)
int ReplaceAllMatches(
    String^ searchText, 
    String^ replaceText, 
    bool matchCase, 
    bool matchWholeWord, 
    bool useRegularExpressions
)
abstract ReplaceAllMatches : 
        searchText:string * 
        replaceText:string * 
        matchCase:bool * 
        matchWholeWord:bool * 
        useRegularExpressions:bool -> int
function ReplaceAllMatches(
    searchText : String, 
    replaceText : String, 
    matchCase : boolean, 
    matchWholeWord : boolean, 
    useRegularExpressions : boolean
) : int

參數

  • searchText
    類型:String

    要比對的文字。

  • replaceText
    類型:String

    取代文字。

  • matchCase
    類型:Boolean

    如果搜尋應該符合大小寫則為 true,否則為 false。

  • matchWholeWord
    類型:Boolean

    如果搜尋應該符合全字拼寫則為 true,否則為 false。

  • useRegularExpressions
    類型:Boolean

    如果搜尋應該使用規則運算式則為 true,否則為 false。

傳回值

類型:Int32
找到的符合項目數。

例外狀況

例外狀況 條件
ArgumentNullException

searchText 為 nullnull 參考 (即 Visual Basic 中的 Nothing)。

ArgumentException

useRegularExpressions是true和searchText是無效的規則運算式。

備註

如果任何找到的符合項目是唯讀的沒有任何相符的項目會被取代。

.NET Framework 安全性

請參閱

參考

IEditorOperations 介面

Microsoft.VisualStudio.Text.Operations 命名空間