FindAndReplace in LotusScript

There’s @ReplaceSubstring in formula, there’s the FindAndReplace method for a NotesRichtextRange in LotusScript, but it doesn’t exist for a ordinary string.

This is the shortest (one line of code) function I can think of to build my own FindAndReplace. It can be a very old tip, or a very obvious one, I don’t know.

It’s really easy: I just split a string with the text-to-find as “splitter”, and join it back with the replacement text.

Function FindAndReplace(SourceText As String,FindText As String,ReplaceText As String) As String
End Function

Gimme some feedback! Do you know this for years? Do you have another way of achieving this? Are there downsides?


  1. Martin,
    Why don’t you just use the ‘built-in’ Replace function ?

  2. Hi Theo,
    According to Designer Help, this function is meant to replace elements in arrays. Or maybe you know how to use it in a different way?

  3. Hi Martin,

    The built-in Replace function works just fine on plain strings.

    strMyString = Replace(strMyString, “”, “Ken”)


Submit a Comment

Your email address will not be published. Required fields are marked *

28 − 25 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>