如何使用(##)通过forall循环连接Lotus脚本中的字符串?

问题描述 投票:0回答:1

我想通过forall循环连接具有多个值的字符串这是代码:

varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
Forall strAttachmentName in varAttachmentNames
    Set object = doc.GetAttachment( strAttachmentName )
    fileName = object.Name
End Forall

在循环结束时,如果有多个文件,我希望在那里的名称为abc.pdf ## xyz.pdf,它们都是文件名(字符串变量)中的单独文件名abc和xyz,

lotus-notes lotusscript domino-designer-eclipse
1个回答
0
投票

有很多可能性,有些甚至不需要LotusScript-Loop:

首先:已经在公式中进行串联:

Dim strResult as String
varAttachmentNames = Evaluate( {@Implode( @AttachmentNames , "##")} , doc )
strResult = varAttachmentNames(0)

第二:在LotusScript中使用@ Implode-副本:

Dim strResult as String
varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
strResult = Implode( varAttachmentNames, "##" )

第三:使用您的无限循环:

Dim strResult as String
varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
Forall strAttachmentName in varAttachmentNames
    Set object = doc.GetAttachment( strAttachmentName )
    fileName = object.Name
    If strResult = "" then
        strResult = fileName
    Else
        strResult = strResult & "##" & fileName
    End If
End Forall
© www.soinside.com 2019 - 2024. All rights reserved.