开发者

Visual Studio Macros: Loop through Selection, add .Append(" and ") to each line in selection

开发者 https://www.devze.com 2022-12-24 11:37 出处:网络
Found this: Sub SurroundWithAppendTag() DTE.ActiveDocument.Selection.Text = \".Append(\"\"\" + DTE.ActiveDocument.Selection.Text + \"\"\")\"

Found this:

Sub SurroundWithAppendTag()
        DTE.ActiveDocument.Selection.Text = ".Append(""" + DTE.ActiveDocument.Selection.Text + """)"
End Sub

But I can't seem to figure out how to 开发者_如何学Cloop through each line of text in the selection. Any thoughts?


Simple:

Dim lines = DTE.ActiveDocument.Selection.Text.Replace(vbCrLf, vbLf).Split(vbLf)

The rest is up to you...

0

精彩评论

暂无评论...
验证码 换一张
取 消