Muh*_*leh 0 lotus-notes lotusscript domino-designer-eclipse
我想用 forall 循环连接具有多个值的字符串,这里是代码:
varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
Forall strAttachmentName in varAttachmentNames
Set object = doc.GetAttachment( strAttachmentName )
fileName = object.Name
End Forall
Run Code Online (Sandbox Code Playgroud)
在循环结束时,如果有多个文件,我希望它们的名称为 abc.pdf##xyz.pdf 都是文件名中的单独文件名 abc 和 xyz(字符串变量)
有很多可能性,有些甚至不需要 LotusScript-Loop:
第一:已经在公式中进行连接:
Dim strResult as String
varAttachmentNames = Evaluate( {@Implode( @AttachmentNames , "##")} , doc )
strResult = varAttachmentNames(0)
Run Code Online (Sandbox Code Playgroud)
第二:在 LotusScript 中使用 @Implode- 对应物:
Dim strResult as String
varAttachmentNames = Evaluate( "@AttachmentNames" , doc )
strResult = Implode( varAttachmentNames, "##" )
' or with the (in other programming languages) more common alias "Join":
'strResult = Join( varAttachmentNames, "##" )
Run Code Online (Sandbox Code Playgroud)
第三:使用你的 Forall 循环:
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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
237 次 |
| 最近记录: |