Skip to content
cosmodev ~/tools/list-set-ops

Операції над множинами зі списків

Converters & Formatters

Обчислюйте об’єднання, перетин, різницю або симетричну різницю двох списків, розділених переносами рядків. Результати без дублікатів з опційними обрізанням і регістронезалежним збігом. Працює повністю у вашому браузері, з посиланням для поширення.

Результат
Введіть елементи в обидва списки, щоб побачити результат.

(Документація англійською)

What it does

Compares two newline-separated lists using the four classic set operations - union, intersection, difference, and symmetric difference - and returns the deduplicated result. Each list is pasted into its own box; the result updates live as you type or switch operation.

It is the quickest way to answer questions like “which items appear in both files?”, “what did I remove from version B?”, or “give me everything, but only once”. Whitespace is trimmed and blank lines dropped by default, and an optional case-insensitive mode treats Foo and foo as the same item while preserving the first casing seen.

How to use it

  1. Paste your first list into List A and your second into List B (one item per line).
  2. Pick the Operation: Union (A ∪ B), Intersect (A ∩ B), A − B (items only in A), or Symmetric (items in exactly one list).
  3. Toggle Trim to strip whitespace and drop empty lines (on by default), or Case-insensitive to match across casing.
  4. Copy the result with the copy button, or share a link that encodes both lists and settings.

Examples

Union of two lists (deduped, A then B):

A: apple       B: banana        →  apple
   banana         cherry            banana
   cherry         date              cherry
                                    date

Intersection (items in both):

A: apple       B: banana        →  banana
   banana         cherry            cherry
   cherry         date

Difference A − B (items only in A):

A: apple       B: banana        →  apple
   banana         cherry
   cherry         date

Case-insensitive intersection (X matches x, first-seen casing emitted):

A: X           B: x             →  X

Good to know

  • Ordering: Union emits A’s items first (in order) then B’s new items; intersection and difference preserve A’s order; symmetric difference lists A-only then B-only. Items are always deduplicated.
  • Case handling: By default Foo and foo are distinct. Enable Case-insensitive to treat them as one, keeping the first casing encountered.
  • Private: all processing runs 100% client-side - your lists never leave the browser.
  • Related tools: List Converter (change separators, sort, dedupe a single list), Sort Lines, Remove Duplicate Lines.
Вихідний код14 мов

100% на боці клієнта · ваші дані ніколи не залишають ваш браузер. Було корисно? Поділіться з колегою.