FindAndReplace (NotesRichTextRange - LotusScript®)

Replaces the next occurrence of a string in a rich text range, and moves the current position to the beginning of the first occurrence of the string.

Defined in

NotesRichTextRange

Syntax

count& = notesRichTextRange .FindAndReplace( target$ , replacement$ , [ options& ] )

Parameters

target$

String. The search string.

replacement$

String. The replacement string.

options$

Long. Any of the following search options. Specify multiple options by combining them with addition or logical ORs.

  • RT_FIND_ACCENTINSENSITIVE (4) for accent insensitive search (default is accent sensitive)
  • RT_FIND_CASEINSENSITIVE (1) for case insensitive search (default is case sensitive)
  • RT_FIND_PITCHINSENSITIVE (2) for pitch insensitive search (default is pitch sensitive)
  • RT_REPL_ALL (16) to replace all occurrences of the search string

  • RT_REPL_PRESERVECASE (8) to preserve case in the replacement string

Return value

count&

Long. The number of replacements made.

Usage

For purposes of navigation, this method finds an element of type RTELEM_TYPE_TEXTRUN. The current position becomes the first character of the search string within the element (not the first character of the element).

All navigation markers in the RTitem, including ranges, are invalidated after a FindAndReplace operation. A new range must be created with SetBegin/SetEnd if you want to use additional RichTextRange methods.

Example