IVsFindHelper.FindInText 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
查找文本字符串中的文本模式,并根据需要替换文本模式。
public:
int FindInText(System::String ^ pszFind, System::String ^ pszReplace, System::UInt32 grfFindOptions, System::UInt32 grfBufferFlags, System::UInt32 cchText, cli::array <System::UInt16> ^ pchText, [Runtime::InteropServices::Out] System::UInt32 % piFound, [Runtime::InteropServices::Out] System::UInt32 % pcchFound, [Runtime::InteropServices::Out] System::String ^ % pbstrReplaceText, [Runtime::InteropServices::Out] int % pfFound);
int FindInText(std::wstring const & pszFind, std::wstring const & pszReplace, unsigned int grfFindOptions, unsigned int grfBufferFlags, unsigned int cchText, std::Array <unsigned short> const & pchText, [Runtime::InteropServices::Out] unsigned int & piFound, [Runtime::InteropServices::Out] unsigned int & pcchFound, [Runtime::InteropServices::Out] std::wstring const & & pbstrReplaceText, [Runtime::InteropServices::Out] int & pfFound);
public 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);
abstract member FindInText : string * string * uint32 * uint32 * uint32 * uint16[] * uint32 * uint32 * string * int -> int
Public Function FindInText (pszFind As String, pszReplace As String, grfFindOptions As UInteger, grfBufferFlags As UInteger, cchText As UInteger, pchText As UShort(), ByRef piFound As UInteger, ByRef pcchFound As UInteger, ByRef pbstrReplaceText As String, ByRef pfFound As Integer) As Integer
参数
- pszFind
- String
中要查找的文本模式。
- pszReplace
- String
中替换文本模式。
- grfFindOptions
- UInt32
中搜索选项。 值取自 __VSFINDOPTIONS 枚举。
- grfBufferFlags
- UInt32
中指示行的 pchText 开头或结尾的标志。 值取自 __VSFINDBUFFERFLAGS 枚举。
- cchText
- UInt32
中文本的大小(以 Unicode 字符为格式)。
- pchText
- UInt16[]
[size_is (cchText) ]要搜索的文本缓冲区 pszFind 。
- piFound
- UInt32
弄缓冲区中指向匹配项的索引。
- pcchFound
- UInt32
弄找到的匹配项的长度。
- pbstrReplaceText
- String
弄计算的替换文本(如有必要)。
- pfFound
- Int32
[out,retval] 如果找到模式,则为 true。
返回
如果该方法成功,则它会返回 S_OK。 如果该方法失败,则会返回错误代码。
注解
COM 签名
从 textfind:
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 已指定选项。