Categories

Array Operations

Perform set operations (intersection, union, difference) on two arrays

Key Facts

Category
Data Processing
Input Types
textarea, select, checkbox, text
Output Type
text
Sample Coverage
4
API Ready
Yes

Overview

The Array Operations tool allows you to quickly perform mathematical set operations on two lists of data. Whether you need to find common elements, merge lists, or identify unique differences, this utility simplifies complex array comparisons into a single click.

When to Use

  • When you need to identify common items between two large datasets or lists.
  • When you want to merge two lists while removing duplicate entries.
  • When you need to compare two configurations or user lists to find missing or extra items.

How It Works

  • Input your first and second arrays using JSON format, comma-separated values, or one item per line.
  • Select the desired set operation, such as Intersection, Union, or Difference, from the dropdown menu.
  • Adjust optional settings like case sensitivity or whitespace trimming to ensure data consistency.
  • Click the process button to generate the resulting array based on your selected logic.

Use Cases

Comparing two customer email lists to find new leads that are not yet in your CRM.
Merging two product inventory lists while automatically deduplicating shared items.
Validating if a specific set of user permissions is a subset of a broader security group.

Examples

1. Finding Missing Inventory Items

Warehouse Manager
Background
You have a list of items expected in a shipment and a list of items actually scanned into the system.
Problem
Identify which items from the expected list are missing from the scanned list.
How to Use
Paste the expected items into Array 1 and scanned items into Array 2, then select 'Difference (A - B)'.
Example Config
operation: difference, trimWhitespace: true
Outcome
A clean list of all items that were expected but failed to appear in the scanned inventory.

2. Merging User Access Lists

IT Administrator
Background
You have two separate lists of users who require access to a new server.
Problem
Create a single master list of unique users without duplicates.
How to Use
Paste both lists into the input fields and select 'Union (A ∪ B)'.
Example Config
operation: union, caseSensitive: false
Outcome
A consolidated list containing every unique user from both groups, ready for import.

Try with Samples

text

Related Hubs

FAQ

What input formats are supported?

You can provide arrays as JSON lists (e.g., [1, 2, 3]), comma-separated values, or by placing each item on a new line.

How does the 'Difference' operation work?

The Difference (A - B) operation returns all elements that are present in the first array but not in the second array.

Can I compare strings with different casing?

Yes, you can toggle the 'Case Sensitive' option off to treat 'Apple' and 'apple' as the same value.

What is the difference between Union and Intersection?

Union (A ∪ B) combines all unique elements from both arrays, while Intersection (A ∩ B) returns only the elements found in both arrays.

Are there limits to the number of items I can process?

The tool is designed for efficient browser-based processing, capable of handling thousands of items instantly.

API Documentation

Request Endpoint

POST /en/api/tools/array-operations

Request Parameters

Parameter Name Type Required Description
array1 textarea Yes -
array2 textarea Yes -
operation select Yes -
caseSensitive checkbox No -
trimWhitespace checkbox No -
customSeparator text No -

Response Format

{
  "result": "Processed text content",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}
Text: Text

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-array-operations": {
      "name": "array-operations",
      "description": "Perform set operations (intersection, union, difference) on two arrays",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=array-operations",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

If you encounter any issues, please contact us at [email protected]