How to Use This Calculator
- Paste your text into the input area. Each line should be on a new line.
- Click the "Calculate" button to process the text.
- The calculator will remove duplicate lines while preserving the order of their first occurrence.
- The result will be displayed in the output area.
Working Principle
This calculator uses a hash set (JavaScript Set
object) to track unique lines. When processing each line:
- The line is trimmed to remove leading/trailing whitespace
- If the line has not been seen before, it's added to both the output array and the set of seen lines
- If the line has been seen before, it's ignored
Example
Input:
apple
banana
apple
orange
banana
lemon
Output:
apple
banana
orange
lemon
Applications
This calculator can be useful for:
- Cleaning log files to remove repeated entries
- Processing configuration files with duplicate lines
- Creating unique lists from input data
- Preparing data for analysis by removing duplicates