在 ASP Classic VBScript 上的继续行(下划线)之间添加注释

发布于 2024-12-06 19:10:34 字数 670 浏览 0 评论 0原文

我目前正在尝试弄清楚如何在 ASP classic 的行延续语句中添加注释。我们的代码管理要求要求我们编写一个 Start 块和 End 块来标记我们进行更改的位置。例如。

旧代码

arrayName = Array("FIRST_NAME", _
                  ,"LAST_NAME" _
                  ,"ADDRESS"
                  )

新代码

arrayName = Array("FIRST_NAME" _
                  ,"LAST_NAME" _
                  ,"ADDRESS" _
                  ' 2011/09/27 bob Added new column for XYZ support Start
                  ,"NEW_COLUMN" _
                  ' 2011/09/27 bob Added new column for XYZ support End
                  )

新代码会导致错误,因为下划线无法放置在注释中。无论如何,是否可以在这些行之间放置代码管理注释?只是想看看我是否错过了其他选择。我认为没有,但是你们觉得怎么样?

I am currently trying to figure out how to add comment within a line continuation statement on ASP classic. Our code management requirement requires us to write a Start block and End block to mark the place where we did a change. For example.

Old code

arrayName = Array("FIRST_NAME", _
                  ,"LAST_NAME" _
                  ,"ADDRESS"
                  )

New code

arrayName = Array("FIRST_NAME" _
                  ,"LAST_NAME" _
                  ,"ADDRESS" _
                  ' 2011/09/27 bob Added new column for XYZ support Start
                  ,"NEW_COLUMN" _
                  ' 2011/09/27 bob Added new column for XYZ support End
                  )

The new code is causing an error since the underbar cannot be placed within the comment. Are there anyway to place code management comment between such lines? Just want to see if I may have missed other options. I think there is none but what do you guys/gals think?

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

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

发布评论

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

评论(2

提赋 2024-12-13 19:10:34

如果注释行位置对您来说非常重要,您可能需要编写自己的数组推送程序。
所以,你没有错过任何事情。这就是 VBScript 语法 的原因。

使用 下划线,实际运行如下:

Array("FIRST_NAME", "LAST_NAME", "ADDRESS", '评论, "NEW_COLUMN", '评论)

这也会导致错误。
< br>
我写这篇文章是为了提供有关推入数组的想法。

Sub [+](arrT, ByVal val)
    Dim iIdx : iIdx = 0
    If IsArray(arrT) Then
        iIdx = UBound(arrT) + 1
        ReDim Preserve arrT(iIdx)
    Else
        ReDim arrT(iIdx)
    End If      
    arrT(iIdx) = val
End Sub

'Start push

[+]arrayName, "FIRST_NAME"
[+]arrayName, "LAST_NAME"
[+]arrayName, "ADDRESS" 
'2011/09/27 bob Added new column for XYZ support Start
[+]arrayName, "NEW_COLUMN"
'2011/09/27 bob Added new column for XYZ support End

'Test
Response.Write Join(arrayName, "<br />")

If the comment line position is very important for you, you may need to write your own array push procedure.
So, you have not missed anything. This is the cause of VBScript syntax.
With underscore, actually runs following:

Array("FIRST_NAME", "LAST_NAME", "ADDRESS", 'comment, "NEW_COLUMN", 'comment)

And this will cause an error too.

I wrote this to giving idea about push into arrays.

Sub [+](arrT, ByVal val)
    Dim iIdx : iIdx = 0
    If IsArray(arrT) Then
        iIdx = UBound(arrT) + 1
        ReDim Preserve arrT(iIdx)
    Else
        ReDim arrT(iIdx)
    End If      
    arrT(iIdx) = val
End Sub

'Start push

[+]arrayName, "FIRST_NAME"
[+]arrayName, "LAST_NAME"
[+]arrayName, "ADDRESS" 
'2011/09/27 bob Added new column for XYZ support Start
[+]arrayName, "NEW_COLUMN"
'2011/09/27 bob Added new column for XYZ support End

'Test
Response.Write Join(arrayName, "<br />")
如梦初醒的夏天 2024-12-13 19:10:34

请使用此注释:

' 2011/09/27 bob Added "NEW_COLUMN" for XYZ support
arrayName = Array("FIRST_NAME" _
                  ,"LAST_NAME" _
                  ,"ADDRESS" _
                  ,"NEW_COLUMN" _
                  )

您的版本控制系统将负责显示差异,因此 startend 注释几乎没有用处。

Use this comment instead:

' 2011/09/27 bob Added "NEW_COLUMN" for XYZ support
arrayName = Array("FIRST_NAME" _
                  ,"LAST_NAME" _
                  ,"ADDRESS" _
                  ,"NEW_COLUMN" _
                  )

Your version control system will take care of showing the differences so there's little use for the start and end comments.

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