找到,并选择性地替换,在文本字符串中的文本模式。
命名空间: Microsoft.VisualStudio.TextManager.Interop
程序集: Microsoft.VisualStudio.TextManager.Interop(在 Microsoft.VisualStudio.TextManager.Interop.dll 中)
语法
声明
Function FindInText ( _
pszFind As String, _
pszReplace As String, _
grfFindOptions As UInteger, _
grfBufferFlags As UInteger, _
cchText As UInteger, _
pchText As UShort(), _
<OutAttribute> ByRef piFound As UInteger, _
<OutAttribute> ByRef pcchFound As UInteger, _
<OutAttribute> ByRef pbstrReplaceText As String, _
<OutAttribute> ByRef pfFound As Integer _
) As Integer
int FindInText(
string pszFind,
string pszReplace,
uint grfFindOptions,
uint grfBufferFlags,
uint cchText,
ushort[] pchText,
out uint piFound,
out uint pcchFound,
out string pbstrReplaceText,
out int pfFound
)
int FindInText(
[InAttribute] String^ pszFind,
[InAttribute] String^ pszReplace,
[InAttribute] unsigned int grfFindOptions,
[InAttribute] unsigned int grfBufferFlags,
[InAttribute] unsigned int cchText,
[InAttribute] array<unsigned short>^ pchText,
[OutAttribute] unsigned int% piFound,
[OutAttribute] unsigned int% pcchFound,
[OutAttribute] String^% pbstrReplaceText,
[OutAttribute] int% pfFound
)
abstract FindInText :
pszFind:string *
pszReplace:string *
grfFindOptions:uint32 *
grfBufferFlags:uint32 *
cchText:uint32 *
pchText:uint16[] *
piFound:uint32 byref *
pcchFound:uint32 byref *
pbstrReplaceText:string byref *
pfFound:int byref -> int
function FindInText(
pszFind : String,
pszReplace : String,
grfFindOptions : uint,
grfBufferFlags : uint,
cchText : uint,
pchText : ushort[],
piFound : uint,
pcchFound : uint,
pbstrReplaceText : String,
pfFound : int
) : int
参数
pszFind
类型:String[in] 查找的文本模式。
pszReplace
类型:String[in] 替换文本模式。
grfFindOptions
类型:UInt32[in] 搜索选项。 值从 __VSFINDOPTIONS 枚举中采用。
grfBufferFlags
类型:UInt32[in] 标记指示 pchText 开始或结束行。 值从 __VSFINDBUFFERFLAGS 枚举中采用。
cchText
类型:UInt32[in] 文本的大小,在 Unicode 字符。
pchText
类型:array<UInt16[][in, size_is(cchText)] 搜索的文本缓冲区 pszFind。
piFound
类型:UInt32%[out] 在指向匹配缓冲区的索引。
pcchFound
类型:UInt32%[out] 找到的匹配项的长度。
pbstrReplaceText
类型:String%[out] 计算的替换文本,如果需要,。
pfFound
类型:Int32%[out, retval] true ,如果找到模式。
返回值
类型:Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。
备注
COM 签名
从 textfind.idl:
HRESULT IVsFindHelper::FindInText(
[in] LPCOLESTR pszFind,
[in] LPCOLESTR pszReplace,
[in] VSFINDOPTIONS grfFindOptions,
[in] VSFINDBUFFERFLAGS grfBufferFlags,
[in] ULONG cchText,
[in,size_is(cchText)] LPCOLESTR pchText,
[out] ULONG * piFound,
[out] ULONG * pcchFound, [out] BSTR * pbstrReplaceText
);
IVsFindHelper 接口指针传递给 Find 和 Replace。 如果要支持通配符、正则表达式或全字,使用 FindInText 执行匹配的字符串,以便所有的选项和行为一致地用于 Visual Studio 编辑器。
计算的替换文本。 pbstrReplaceText返回。
计算的替换文本是必需的。以下条件:
FR_RegExpr, FR_Replace,选项,并标记或字符转义出现在 pszReplace。
FR_KeepCase 选项指定。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。