MarkSubStringA,  MarkSubStringW Functions

Top  Previous  Next

Marks all occurrences of s in rv.

Unit MarkSearch.

  TRVMarkStringOption = (

    rvmsoIgnoreCase, rvmsoWholeWords, rvmsoNormalize, 

    rvmsoStripDiacritic, rvmsoIgnorePunctuation);
  TRVMarkStringOptions = set of TRVMarkStringOption;


function MarkSubStringA(const s: TRVAnsiString; Color, BackColor: TColor;
  Options: TRVMarkStringOptions; rv: TCustomRichView;
  RVData: TCustomRVData = nil): Integer;
function MarkSubStringW(const s: TRVUnicodeString; Color, BackColor: TColor;
  Options: TRVMarkStringOptions; rv: TCustomRichView;
  RVData: TCustomRVData = nil): Integer;

All occurrences of s are marked with the specified Color and BackColor.

RVData may specify the document to process. If it is nil, the whole document in rv is processed (i.e. RVData = nil works like RVData = rv.RVData).

Options for the both functions:




If set, character case is ignored when comparing


If set, only occurrences as whole words are marked. "Word" is surrounded by characters listed in rv.Delimiters property.

Options for the both MarkSubStringW:




If set, text is normalized when comparing (Compatibility Decomposition form). With this option, you can search for '1' and find '' (and vice versa); or you can search for 'ト' and find ''.


Works like rvmsoNormalize, and also all diacritic characters are ignored. For example, you can search for 'Ä' and find 'A' (and vice versa).


If set, any sequence of punctuation characters (i.e. characters listed in rv.Delimiters property) is treated as a single space character. For example, you can search for 'Hello world.' and find 'Hello, world!!!' (and vice versa).

This operation is not an editing operation, it cannot be undone.

These functions are not used in RichViewActions. They are included in RichViewActions for a convenience.

Limitation: this function searches text in each text item separately.

Platform notes:

rvmsoIgnoreCase for Unicode text works only on WinNT-based systems (WinNT4, Win2000, WinXP and newer)

rvmsoNormalize and rvmsoStripDiacritic work in Windows Vista and newer. For WinXP, it requires libraries from

RichViewActions ©