Show/Hide Toolbars

EmEditor Help

Navigation: EmEditor Help > Macro Reference > Document Object > Methods

Macro: DeleteDuplicates Method

Scroll Prev Top Next More
EmEditor Home - EmEditor Help - EmEditor Macro Reference - Document Object

DeleteDuplicates Method

Deletes duplicate lines, or sets bookmarks on duplicate lines.


nCount = document.DeleteDuplicates( [ strColumns, [ flags ] ] );


nCount = document.DeleteDuplicates( [ strColumns, [ flags ] ] )



Specifies a string containing one-based indexes of columns separated by commas if a CSV document is active. For instance, "1,3,5" means the column 1, 3, and 5. The specified columns are inspected while deleting or bookmarking duplicates. If the string is empty, the whole lines are inspected. This value must be empty if a non-CSV document is active. If this is omitted, the whole lines are inspected.


Specifies a combination of the following values. If this is omitted, no flags are specified.


Inspects only adjacent lines. This flag is useful if the document has been already sorted.


Bookmarks duplicate lines. If this flag is not specified, the method deletes the duplicate lines.


Ignores all empty cells when searching for duplicate lines in CSV documents.


Ignores all the empty lines when deleting or bookmarking duplicate lines.


Deletes or bookmarks all lines of each duplicate.


Ignores case.


Inspects only the selected strings when vertical selection or multiple selections exist. This flag is ignored if the strColumns parameter is specified.


Inspects only the selected lines.

Return Values

The return value is the number of duplicate lines that were found.


Supported on EmEditor Professional Version 16.4 or later.

Copyright © 2003-2022 by Emurasoft, Inc.