LotusScript function to do character replacement in a string variable...
In some of my coding projects, I have a need to, within a LotusScript agent, scrub certain characters out of a string variable, like line feeds. I use the following function to take care of that for me. I'm posting it here mainly so that I can easily find it when I need it next time (and I don't have a copy of an app that uses it), but if you find it of use, feel free to "R&D" it (Rob & Duplicate)...
Function scrubString(strField As String, strBadStuff As String, strGoodStuff As String) As String
'This function will search the passed string for the "bad" stuff to be removed, and will replace it with the "good" stuff
Dim intLength As Integer
Dim intReplacePos As Integer
'Keep ripping and replacing while "bad" stuff still exists
Do While Instr(strField, strBadStuff) > 0
intLength = Len(strField)
intReplacePos = Instr(strField, strBadStuff)
strField = Left(strField, intReplacePos -1) + strGoodStuff + Right(strField, intLength - intReplacePos)
'Return the cleaned up field to the calling routine
scrubString = strField