IVsFindTarget.Replace 方法

请求文本字符串替换。

命名空间:  Microsoft.VisualStudio.TextManager.Interop
程序集:  Microsoft.VisualStudio.TextManager.Interop(在 Microsoft.VisualStudio.TextManager.Interop.dll 中)

语法

声明
Function Replace ( _
    pszSearch As String, _
    pszReplace As String, _
    grfOptions As UInteger, _
    fResetStartPoint As Integer, _
    pHelper As IVsFindHelper, _
    <OutAttribute> ByRef pfReplaced As Integer _
) As Integer
int Replace(
    string pszSearch,
    string pszReplace,
    uint grfOptions,
    int fResetStartPoint,
    IVsFindHelper pHelper,
    out int pfReplaced
)
int Replace(
    [InAttribute] String^ pszSearch, 
    [InAttribute] String^ pszReplace, 
    [InAttribute] unsigned int grfOptions, 
    [InAttribute] int fResetStartPoint, 
    [InAttribute] IVsFindHelper^ pHelper, 
    [OutAttribute] int% pfReplaced
)
abstract Replace : 
        pszSearch:string * 
        pszReplace:string * 
        grfOptions:uint32 * 
        fResetStartPoint:int * 
        pHelper:IVsFindHelper * 
        pfReplaced:int byref -> int
function Replace(
    pszSearch : String, 
    pszReplace : String, 
    grfOptions : uint, 
    fResetStartPoint : int, 
    pHelper : IVsFindHelper, 
    pfReplaced : int
) : int

参数

  • pszSearch
    类型:String

    [in] 为 null 指针已停止包含搜索的文本字符串。

  • pszReplace
    类型:String

    [in] 对包含替换文本的 null 终止的字符串的指针。

  • grfOptions
    类型:UInt32

    [in] 指定选项。 值从 __VSFINDOPTIONS 枚举中采用。

  • fResetStartPoint
    类型:Int32

    [in] 标记重置搜索的起点。

  • pfReplaced
    类型:Int32%

    [out, retval] true ,如果替换成功。

返回值

类型:Int32
如果方法成功,则返回 S_OK。如果失败,它会返回一个错误代码。

备注

COM 签名

从 textmgr.idl:

HRESULT IVsFindTarget::Replace(
   [in] LPCOLESTR pszSearch,
   [in] LPCOLESTR pszReplace,
   [in] VSFINDOPTIONS grfOptions,
   [in] BOOL fResetStartPoint,
   [in] IVsFindHelper * pHelper
);

Find 在 Replace之前调用。 当 Replace 调用时,应验证当前选择字符串与 pszSearch相等,然后右 pszReplace替换选定内容。

.NET Framework 安全性

请参阅

参考

IVsFindTarget 接口

Microsoft.VisualStudio.TextManager.Interop 命名空间