Check for duplicates
Description
Detect duplicate characters in strings and duplicate items in lists using Clarity
Use Cases
Validating usernames for uniqueness of characters
Checking NFT trait uniqueness in collections
Preventing duplicate entries in voting systems
Ensuring unique identifiers in lists
Key Concepts
Strings - Uses
foldwithindex-of?to find repeated charactersLists - Checks if elements appear again in the remaining list
Optimization - Early exit on first duplicate found
Last updated
Was this helpful?