Saturday, November 15, 2008

LotusScript equivalents for the @ReplaceSubstring

Function ReplaceSubstringEvaluate (Byval fullString As String, oldString As String,
newString As String) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim var As Variant

Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)

Call doc.ReplaceItemValue("FullString", fullString)
Call doc.ReplaceItemValue("OldString", oldString)
Call doc.ReplaceItemValue("NewString", newString)

var = Evaluate("@ReplaceSubstring(fullString; oldString; newString)", doc)
ReplaceSubstringEvaluate = var(0)

'** clean up the memory we used
Set doc = Nothing
Set db = Nothing

End Function

No comments: