Lotus Notes FAQ Visit Our Sponsor!

Is there a @Replace equivalent function in LotusScript?

Unfortunately, LotusScript doesn't have this function that can be found in MS VBScript (the Replace function). Andy Armstrong (andy@tagish.com) coded this up:

' Return strArg with instances of strSrc replaced by strDst. After each
' replace searching recommences after
' the last character of the replacement
'
' History:
'
' 23-12-1998 AA Initial release

Function StringStuffReplaceString(Byval strArg As String,
Byval strSrc As String,
Byval strDst As String) As String
Dim iPos As Integer
iPos = Instr(strArg, strSrc)
While iPos > 0
strArg = Left$(strArg, iPos - 1) + strDst + Mid$(strArg, iPos +
Len(strSrc))
iPos = Instr(iPos + Len(strDst), strArg, strSrc)
Wend
StringStuffReplaceString = strArg
End Function


Applies to Notes Versions: 4 4.5 4.6 5
Last Modified: June 20, 2001