Partager via


IVsFindHelper.FindInText, méthode

Les recherches, et remplace éventuellement, un modèle de texte dans une chaîne de texte.

Espace de noms :  Microsoft.VisualStudio.TextManager.Interop
Assembly :  Microsoft.VisualStudio.TextManager.Interop (dans Microsoft.VisualStudio.TextManager.Interop.dll)

Syntaxe

'Déclaration
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

Paramètres

  • pszFind
    Type : String

    [in] modèle de texte à le rechercher.

  • pszReplace
    Type : String

    [in] modèle de texte de remplacement.

  • grfFindOptions
    Type : UInt32

    [in] options de recherche. Des valeurs sont prises de l'énumération d'__VSFINDOPTIONS.

  • grfBufferFlags
    Type : UInt32

    [in] marquez d'un indicateur indiquer cet pchText commence ou termine une ligne. Des valeurs sont prises de l'énumération d'__VSFINDBUFFERFLAGS.

  • cchText
    Type : UInt32

    [in] taille de texte, en Unicode personnages.

  • pchText
    Type : array<UInt16[]

    [in, size_is (cchText)] Mémoire tampon de texte pour rechercher pszFind.

  • piFound
    Type : UInt32%

    [] index dans le pointage de mémoire tampon à correspondre à.

  • pcchFound
    Type : UInt32%

    [] longueur de correspondance recherchée.

  • pbstrReplaceText
    Type : String%

    [] calculé texte de remplacement, si nécessaire.

  • pfFound
    Type : Int32%

    [out, retval] true si le modèle était recherché.

Valeur de retour

Type : Int32
Si la méthode réussit, elle retourne S_OK.En cas d'échec, un code d'erreur est retourné.

Notes

Signature de COM

De 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
);

Un pointeur d'interface d'IVsFindHelper est passé à l'Find et à l'Replace. Si vous souhaitez prendre en charge des caractères génériques, des expressions régulières, ou des mots entiers, utilisation FindInText d'utiliser la correspondance de chaîne afin que tous les options et comportement fonctionnent compatible à l'éditeur de Visual Studio.

Le texte calculé de remplacement est retourné dans pbstrReplaceText.

Le texte calculé de remplacement est nécessaire dans les conditions suivantes :

  • FR_RegExpr, FR_Replace, options sont spécifiés et les balises ou les caractères d'échappement apparaissent dans pszReplace.

  • l'option d'FR_KeepCase est spécifiée.

Sécurité .NET Framework

Voir aussi

Référence

IVsFindHelper Interface

Microsoft.VisualStudio.TextManager.Interop, espace de noms