替换给定字符串的所有匹配项。
命名空间: 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 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。