Visual Studio 宏:循环选择,将 .Append(" 和 ") 添加到选择中的每一行

发布于 2024-08-25 20:31:43 字数 215 浏览 5 评论 0 原文

发现了这个:

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

但我似乎无法弄清楚如何循环选择中的每一行文本。有什么想法吗?

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 loop through each line of text in the selection. Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋日私语 2024-09-01 20:31:43

很简单:

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

剩下的就看你的了……

Simple:

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

The rest is up to you...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文