IVsFindHelper.FindInText Method
Finds, and optionally replaces, a text pattern in a text string.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'Declaration
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
Parameters
- pszFind
Type: System.String
[in] Text pattern to find.
- pszReplace
Type: System.String
[in] Replacement text pattern.
- grfFindOptions
Type: System.UInt32
[in] Search options. Values are taken from the __VSFINDOPTIONS enumeration.
- grfBufferFlags
Type: System.UInt32
[in] Flag indicating that pchText begins or ends a line. Values are taken from the __VSFINDBUFFERFLAGS enumeration.
- cchText
Type: System.UInt32
[in] Size of text, in Unicode characters.
- pchText
Type: array<System.UInt16[]
[in, size_is(cchText)] Text buffer to search for pszFind.
- piFound
Type: System.UInt32%
[out] Index in buffer pointing to match.
- pcchFound
Type: System.UInt32%
[out] Length of match found.
- pbstrReplaceText
Type: System.String%
[out] Computed replacement text, if necessary.
- pfFound
Type: System.Int32%
[out, retval] true if pattern was found.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From 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
);
An IVsFindHelper interface pointer is passed to Find and Replace. If you want to support wildcards, regular expressions, or whole words, use FindInText to do your string matching so that all the options and behavior work consistently with the Visual Studio editor.
Computed replacement text is returned in pbstrReplaceText.
Computed replacement text is necessary in the following conditions:
FR_RegExpr, FR_Replace, options are specified and tags or character escapes appear in pszReplace.
FR_KeepCase option is specified.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.