findandReplace (RichTextRange - Java)

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

RichTextRange

Syntax

public int findandReplace(String target, String replacement)
    throws NotesException
public int findandReplace(String target, String replacement, long options)
    throws NotesException

Parameters

String target

The search string.

String replacement

The replacement string.

long options

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

  • RichTextItem.RT_FIND_ACCENTINSENSITIVE for accent insensitive search (default is accent sensitive)
  • RichTextItem.RT_FIND_CASEINSENSITIVE for case insensitive search (default is case sensitive)
  • RichTextItem.RT_FIND_PITCHINSENSITIVE for pitch insensitive search (default is pitch sensitive)
  • RichTextItem.RT_REPL_ALL to replace all occurrences of the search string
  • RichTextItem.RT_REPL_PRESERVECASE to preserve case in the replacement string

Return value

int

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).

The range is reset after a findAndReplace operation.

Example